Pdf-lib: [Feature Request]: Merging PDFs with lazy parsing

Created on 9 Jun 2019  路  3Comments  路  Source: Hopding/pdf-lib

As discussed in #119, pdf-lib might want a function that:

  1. Takes 2+ PDFs and merges them
  2. With as lazy parsing as possible, both to conserve energy and to avoid parse errors if files in the wild are less than stellar, but still openable by PDF readers.

(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.

feature-request

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.

All 3 comments

@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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fatso83 picture fatso83  路  3Comments

emilsedgh picture emilsedgh  路  5Comments

keyhoffman picture keyhoffman  路  4Comments

zimt28 picture zimt28  路  5Comments

faxemaxee picture faxemaxee  路  6Comments