Sample Header Ad - 728x90

How do I extract some pages of a PDF into another PDF file?

0 votes
3 answers
334 views
I have a PDF file with multiple pages, and I want to write a command which extracts some of these pages into a new, separate PDF file; and the pages of interest are not necessarily a contiguous range. How do I do that? Notes: * It has to be a command I can put in a (shell) script, not a GUI application I can interact with to achieve this effect. * The pages to be extracted do not necessarily form a contiguous range. * If you want a concrete example, let's assume I want to extract pages 1 through 4 and page 6 of input file foo.pdf, with the result placed in bar.pdf.
Asked by einpoklum (10753 rep)
May 26, 2025, 11:10 AM
Last activity: May 27, 2025, 03:01 AM