There exists a PDFDocument(Stream outputStream) constructor. The documentation says "Creates a new PDF document using the specified stream. To open an existing PDF file, use the PdfReader class." Given the second sentence and the parameter name "outputStream", I assumed that the constructor configures the document to dump the PDF to that stream (in my case, a FileStream) least every couple hundred pages/KB. (Also in the thought process: If PDFDocument(Stream)/Close() has the same behaviour as PDFDocument()/Save(Stream, false), why do both exist?)
However, there's no evidence (either behaviourly or in the source) that it actually does so.
Is there any way to get the behaviour I was expecting: a PDFDocument that gets written to the passed Stream as I write to the document? Currently, I'm creating documents that manage to consume over 1 GB in memory, which makes me concerned that I might run out of 32-bit address space sometime soon. I realize that this requires some restrictions on what changes I can make, but that's not an issue; once I've drawn on a page, I never modify that drawing except to draw on top of it, and once I add a new page, I never modify any previous page.
I could, if necessary, count up how many objects of what sorts I will be drawing -- I already count pages before I do any drawing, and I could relatively easily count what I draw on those pages, since I have to touch them all anyway.
|