Hi zyx, Seems that the docs are not clear enough on "change the object structure of a PDF file". But I still think it's bug. Otherwise why did drawing lines and drawing XObjects result in different situations? They both are "content streams" after all. As for your advice, I don't quite understand what you've suggested. Do you mean if the input PDF files are more than one page, instead of constructing multiple `PDFXObject`s that reference corresponding pages of input PDF files, I should add the whole document into the output PDF file, then manipulate those newly-added pages?
Regards, Shane zyx <z...@gmx.us> 于2021年6月14日周一 下午9:10写道: > 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 >
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users