Vorrei aggiungere le pagine a un file pdf esistente.aggiungi la pagina al file pdf esistente usando python (e matplotlib?)
Attualmente sto utilizzando le pagine pdf di matplotlib. tuttavia, una volta chiuso il file, il salvataggio di un'altra figura sovrascrive il file esistente anziché aggiungerlo.
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
class plotClass(object):
def __init__(self):
self.PdfFile='c:/test.pdf'
self.foo1()
self.foo2()
def foo1(self):
plt.bar(1,1)
pdf = PdfPages(self.PdfFile)
pdf.savefig()
pdf.close()
def foo2(self):
plt.bar(1,2)
pdf = PdfPages(self.PdfFile)
pdf.savefig()
pdf.close()
test=plotClass()
so apposizione è possibile tramite chiamate multiple a pdf.savefig() prima di chiamare pdf.close(), ma vorrei aggiungere a pdf che è già stato chiuso.
Anche le alternative a matplotlib sarebbero apprezzate.