Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 172a494

Browse filesBrowse files
committed
add convenience pagecount getter method for PdfPages
1 parent 3e61c81 commit 172a494
Copy full SHA for 172a494

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed

‎lib/matplotlib/backends/backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,6 +2310,12 @@ def savefig(self, figure=None, **kwargs):
23102310
else:
23112311
figureManager.canvas.figure.savefig(self, format='pdf', **kwargs)
23122312

2313+
def get_pagecount(self):
2314+
"""
2315+
Returns the current number of pages in the multipage pdf file.
2316+
"""
2317+
return len(self._file.pageList)
2318+
23132319
class FigureCanvasPdf(FigureCanvasBase):
23142320
"""
23152321
The canvas the figure renders into. Calls the draw and print fig

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.