How to Extract Pdf Pages in Linux
We can extract pages(s) from a pdf file using a tool named qpdf on Linux. Here is how I do this task, for your information I use Ubuntu 22.04.
Check whether you have qpdf installed on your machine. If you don't have it, install it first using command
sudo apt install qpdf
To extract a page from a pdf file, execute this command at terminal
qpdf --pages path_file_input page_number -- path_file_input path_file_output
For example, I have a pdf file at /tmp/input.pdf and I want to get the second page only and save the output at /tmp/output.pdf. This is the command to get that task done
qpdf --pages /tmp/input.pdf 2 -- /tmp/input.pdf /tmp/output.pdf
How if you need to extract a range of pages?
Of course you can. For example I'll extract page 2 until 5 from /tmp/input.pdf, this is the spell
qpdf --pages /tmp/input.pdf 2-5 -- /tmp/input.pdf /tmp/output.pdf
Comments
Post a Comment