8000 add convenience pagecount getter method for PdfPages · alcamla/matplotlib@172a494 · GitHub
[go: up one dir, main page]

Skip to content

Commit 172a494

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

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines 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