Multipage pdf files

Or perhaps the user-visible object doesn't need to be the same PdfFile
that is used internally (which I think should be file-like, since when
we add better image compression, we will want to pass the PdfFile to the
png/jpeg/whatever library to write to). Something like

class PdfFileProxy:
    def __init__(self, filename):
        self.pdf_file = PdfFile(filename)

except the name should be better.

···

--
Jouni K. Sepp�nen

"Drain, Theodore R" <theodore.r.drain@...179...> writes:

Another (still slightly hacky) way might be to define an optional attribute of the file object. Something like this:

if hasattr( outputFile, "mplFormat" ):
   format = getattr( outputFile, "mplFormat" )

Then have set PdfFile.mplFormat to be "pdf". This is a little less hacky in that it doesn't depend on coding a specific class into savefig.

Ted

-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…31…]
Sent: Friday, January 02, 2009 7:27 AM
To: matplotlib-devel@lists.sourceforge.net
Subject: Re: [matplotlib-devel] Multipage pdf files

It's slightly hackish, but would it be possible to do an "isinstance"
check in savefig, and if the first arg is a PdfFile, set "format" to
"pdf" automatically, and if "format" is set to something else raise an
exception? A little hackish because it doesn't necessarily scale to
other formats easily, but it would prevent the user from shooting
herself in the foot.

Mike