append page to existing pdf file using python (and matplotlib?)
<p>I would like to append pages to an existing pdf file.</p>

<p>Currently, I am using matplotlib pdfpages. however, once the file is closed, saving another figure into it overwrites the existing file rather than appending.</p>

<pre><code>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()
</code></pre>

<p>I know appending is possible via multiple calls to pdf.savefig() before calling pdf.close() but I would like to append to pdf that has already been closed.</p>

<p>Alternatives to matplotlib would be appreciated also.</p>