How do I extract pages from a PDF?
To extract pages, you copy a run of pages from the original PDF into a new, smaller PDF and leave the original untouched. With this tool you choose the file, type a start page and an end page, click Convert, and download split.pdf containing exactly that range, inclusive at both ends.
The work happens in your browser. The pdf-lib library opens the file, reads its page count, and copies the selected pages into a fresh document. Your original file on disk isn't modified, and no copy of it is uploaded.
A worked example
Say you've received a 40-page supplier contract and only need to send the payment schedule on pages 31 to 34 to your accounts team.
- Click Choose a PDF file and pick the contract.
- Type
31in Start page and34in End page. - Click Convert.
- Click Download. The file
split.pdfhas four pages: 31, 32, 33 and 34 of the original, in that order.
Page numbers here mean physical positions in the file, counting from 1. If the document prints its own numbering (a front section numbered i, ii, iii, or a report that starts at page 0), go by where the page sits in your PDF viewer's thumbnail panel, not by the number printed in the footer.
How the page boxes are read
The two fields are plain text boxes, and the tool is forgiving about what you type. This is how it interprets input, tested against a five-page document:
| Start page | End page | Result |
|---|---|---|
2 |
4 |
Pages 2, 3 and 4 |
3 |
(blank) | Page 3 only; a blank end means "same as start" |
5 |
5 |
Page 5 only |
2.7 |
3.9 |
Pages 2 and 3; decimals are rounded down |
abc |
abc |
Page 1; text that isn't a number counts as 1 |
0 |
9 |
Error: page 9 doesn't exist |
4 |
2 |
Error: start is after end |
A start below 1 is raised to 1. Out-of-range or reversed ranges produce "Enter a valid page range between 1 and N.", where N is the real page count, which is a handy way to find out how long a document is.
Common jobs and how to do them
Remove one page from the middle. There's no delete option, but two splits and a merge do it. To drop page 6 from a 20-page file, extract 1 to 5, then 7 to 20, and join the two downloads with the PDF merger. Rename each download as you go, because both arrive as split.pdf.
Send each chapter separately. Run the tool once per chapter range. The file input keeps your PDF selected, so you only change the numbers and click Convert again.
Turn one page into an image. The PDF to image converters render only the first page of whatever you give them. Extract the page you want here first, then feed split.pdf to PDF to PNG.
Fix a sideways scan inside a longer document. Extract the affected range, run it through Rotate PDF, and merge the pieces back together.
Will the extracted file be smaller?
Usually, though not always in proportion. pdf-lib's page copy brings along every object a page refers to, such as fonts, images and the content stream, and nothing else. So a 4-page extract from a text-heavy contract drops most of the original's weight. But if every page shares one large embedded font, or the pages you keep hold the big photos, the saving is smaller than the page count suggests.
Document-level extras don't come along: bookmarks, the original title and author metadata, and attached files are left out, since the new file is created from scratch and only receives pages. Text remains selectable because pages are copied as PDF objects, not converted to pictures. If the extract is still too large to send, see what compressing the PDF can do.
Protected and damaged files
pdf-lib won't open a PDF that has an encryption dictionary, so password-protected files and files with permission restrictions both fail with a message containing "is encrypted". The PDF specification allows a file to be readable by anyone yet still carry an owner password limiting printing or editing (ISO 32000-1, section 7.6), and those count as encrypted too. Remove the protection in the program that made the file, then split the unprotected copy. A file that isn't a real PDF, such as a renamed web page, fails with "No PDF header found".
Last updated