Skip to content

Conversation

@varevarao
Copy link

@varevarao varevarao commented Feb 13, 2024

  • Puppeteer, and other PDF generation options allow use of a indeterminate page range format (3-, implying page 3 to the end of the file)
  • This would have been possible for consumers by only directly obtaining a page count using the pdf doc instance
  • Updated and added tests for the new functionality

Example:

// Add only the first page of Doc A
await merger.add(path.join(FIXTURES_DIR, 'Testfile_A.pdf'), '1')
// Add page 2 onwards from Doc B
await merger.add(path.join(FIXTURES_DIR, 'Testfile_AB.pdf'), '2-')

OR

// Add all pages until the 5th page of Doc A
await merger.add(path.join(FIXTURES_DIR, 'Testfile_A.pdf'), '-5')
// Add page 2 onwards from Doc B
await merger.add(path.join(FIXTURES_DIR, 'Testfile_B.pdf'), '2-')

@Nico-Mugi
Copy link

Nico-Mugi commented Apr 11, 2024

That's a nice feature that I need for my current project, would be nice if it's merged to the repo.
Tested your modification to the code and works like a charm ! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants