Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow use of indeterminate page ranges #134

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

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.

None yet

2 participants