Let us say you have a PDF file with 100 pages and you want to split or extract particular pages from that file. How can you do that? It's absolutely easy. You don't need to any premium PDF editing applications. In this tutorial, I will show you a simple way to split or extract particular pages from a PDF file on Linux. Even though there are many methods to accomplish this task, I find the following methods are the easiest way to extract a page range or a part of a PDF file in Linux. Just follow these simple steps described below to get this job done in couple minutes.
Table of Contents
Split Or Extract particular pages from A PDF file using PDFtk
I will explain both command line and GUI way. If you use a system that has only CLI mode, follow these steps.
PDFtk is free graphical tool that can be used to split or merge PDF files. You can use it both in CLI and GUI mode. It is available for free and paid.
Install PDFtk on Linux
PDFtk is available in the official repositories of some Linux distributions.
On Arch Linux, PDFtk is available in [community] repository. To install PDFtk on Arch Linux and its variants, run:
$ pacman -S pdftk
On Debian, Ubuntu:
$ sudo apt install pdftk
Note: You need to enable [universe] repository in Ubuntu to install pdftk.
$ sudo add-apt-repository universe
On openSUSE:
$ sudo zypper install pdftk
PDFtk is also available as snap package. Make sure your system has snap installed and run the following command to install PDFtk.
$ sudo snap install pdftk
Usage
Once you installed PDFtk, open your Terminal and extract a range of pdf files as shown below.
$ pdftk source.pdf cat 5-10 output output_p5-10.pdf
Here, source.pdf is my original PDF file. We extract pages from 5 to 10. Finally we save the output in output_p5-10.pdf file. Very simple, isn't it? Of course, it is.
If you want split specific pages from the source file, for example 5, 6, and 10, just run:
pdftk source.pdf cat 5 6 10 output output.pdf
The above command will split the pages 5, 6 and 10 from the source.pdf file and save it as output.pdf file.
Extract particular pages from PDF file using default PDF reader application
This is another absolutely easy and handy trick to extract pages from a PDF file using the default PDF viewer application. Most of desktop Linux distributions comes pre-installed with PDF reader application by default. We can use it to extract a particular set of pages from a PDF document.
Here is how I did it in my Arch Linux desktop.
Open the source pdf file using any PDF reader. For the purpose of this tutorial, I use Atril Document Viewer.
Go to File -> Print.
Select Print to file as printer, enter the output filename, select format as PDF, enter the page range (Here 30-40). And finally click Print.
The selected pages will be extracted from the PDF file. That's it.
Want to know how to merge PDF files? Check the following link,
As you can see, both methods are simple, straight-forward and easy to follow.
Reference:
3 comments
Extracting from your pdf viewer may not preserve page dimensions. This happened to me when using Okular. I had no problem using pdftk.
‘pdftk source.pdf cat 5-10 output output_p12-15.pdf’ .
Finally we save the output in output_p5-10.pdf file. How? by magic? ‘output_p12-15.pdf’ ‘ is the output file.
Thanks for posting on how to split and extract from PDF. pdftk is quite nice. There is also QPDF i havent tried it fully.
Thanks.
Have a nice day