As discussed in #119, pdf-lib might want a function that:
(See #119 , #37, #116 for related bugs)
One possible implementation we could get inspiration from is the poppler pdfunite library, which takes two PDFs and writes a new one uniting the two:
https://searchcode.com/codesearch/view/85365414/
From very quick and shallow googling, it seems like we'd need to copy any objects and object references while updating their references, but without parsing them further? I'm not well versed in PDF structuring, and haven't been able to understand the pdfunite code successfully yet.
@DanielJackson-Oslo I haven't forgotten about this. And I do agree that it would be useful to avoid parsing objects in input PDFs until absolutely necessary. However, it'll probably be a few weeks before I can invest much time into this.
I'd highly recommend that you familiarize yourself with the basics of PDF file structure. Reading through sections 7.1 - 7.7 of the PDF specification should suffice.
No problem at all @Hopding.
Any update?
Most helpful comment
@DanielJackson-Oslo I haven't forgotten about this. And I do agree that it would be useful to avoid parsing objects in input PDFs until absolutely necessary. However, it'll probably be a few weeks before I can invest much time into this.
I'd highly recommend that you familiarize yourself with the basics of PDF file structure. Reading through sections 7.1 - 7.7 of the PDF specification should suffice.