| 464 | | def save_book(self, filename): |
| 465 | | from pyPdf import PdfFileWriter, PdfFileReader |
| 466 | | outfile = PdfFileWriter() |
| 467 | | fns = self.save("__temp", format="pdf") |
| 468 | | concatenate_pdfs(filename, fns) |
| 469 | | for fn in fns: os.unlink(fn) |
| | 464 | def save_book(self, filename, info = None): |
| | 465 | """ |
| | 466 | This will save out a single PDF, where each page is a plot object. The |
| | 467 | *info* keyword can be a dictionary composed of the keys and values |
| | 468 | "Author", "Title", "Subject", "Keywords", "Creator", "Producer" ad |
| | 469 | "CreationDate". Any keywords not filled in will be blank. The default |
| | 470 | is to use the current settings in Matplotlib for filling them in. |
| | 471 | """ |
| | 472 | from matplotlib.backends.backend_pdf import PdfPages |
| | 473 | outfile = PdfPages(filename) |
| | 474 | for plot in self.plots: |
| | 475 | plot.save_to_pdf(outfile) |
| | 476 | if info is not None: |
| | 477 | outfile._file.writeObject(outfile._file.infoObject, info) |
| | 478 | outfile.close() |