On Fri, 2021-06-11 at 16:17 +0800, Shane Hou wrote:
> Reading the docs, I think `PdfStreamedDocument` should be used to
> manipulate my output PDF file, and `PdfMemDocument` should be used to
> read input PDF files.

        Hi,
some operations require the memory document, it's when the content
changes several times.

I do not know what exactly the DrawXObject (or the PdfXObject object
creation) does that it requires the memory document (I'd guess it
modifies some page-related object, which the stream document writes too
soon), but if it does, then just use it instead of the streamed
document.

The stream documents are good for files, which do not change, which can
be written in a single run (or which are read-only). As you are merging
different PDF files, you should also copy the page over to the output
PDF, thus it has all the resources it needs. This copy is inefficient
(see the resulting file size). When you copy more than one page from
the file, it can be better to just add all pages and then modify the
pages array, which requires the memory document, due to the
modifications.

That is just my experience. I'm sorry if it did not help you.
        Bye,
        zyx


_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to