- Extract pages from PDF in Linux
- Using an online tool
- Using PDFShuffler
- Using PDFtk
- Conclusion
- About the author
- Zeeman Memon
- How to extract pages from a PDF in Linux
- How to extract PDF pages in Linux via GUI:
- Step 1:
- Step 2:
- Step 3:
- Step 4:
- Step 5:
- Step 6:
- How to extract PDF pages in Linux via terminal:
- Conclusion:
- About the author
- Sam U
- How To Split or Extract Particular Pages From A PDF File
- Split Or Extract particular pages from A PDF file using PDFtk
- Install PDFtk on Linux
- Usage
- Extract particular pages from PDF file using default PDF reader application
Extract pages from PDF in Linux
Using an online tool
PDF files have become one of the most common means of documenting and distributing data. Owing to their popularity, many websites and programs are designed particularly to manipulate these files. Speaking of which, ILovePDF is a website devoted entirely to this purpose. It has many tools that you can use for free to split, merge, convert, organize, protect, and compress PDF files.
Since we want to extract pages from PDF files, we will use the PDF Splitter tool offered by the website as mentioned above. Once you have the PDF document you want to extract pages from, click here to visit the online PDF Splitter tool.
Click the Select PDF file button and navigate to your document. Once you have uploaded it, you can select whether you want to extract pages or split the file by range.
Go ahead and select the options you need from the buttons on the right side. Once you are done, click the Split PDF, and that should be it. It will initialize downloading a .zip file that contains your extracted pages.
ILovePDF also has a free downloadable app, but unfortunately, it is only available for Windows and macOS. However, that does not take away from its ability to help you extract pages from PDFs on Linux since you can use it online too. With that being said, you can now use a completely free online PDF splitting tool to select specific pages from PDF files and extract them without any trouble!
Using PDFShuffler
If for whatever reason – may it be due to privacy concerns or lack of functionality – the previous method did not convince you, fret not, as we have more favorable recommendations for you to try out.
One of which is PDFShuffler, a handy python-gtk app that lets its users manipulate PDF files easily. Its features include merging, splitting, cropping, rotating, and rearranging PDF files. The tool adds to its extensive functionality through its easy-to-grasp and intuitive graphical interface.
You can click here to download PDFShuffler from Source Forge, or you can do it the old-fashioned way through the command line. Navigate to the Activities menu or press Ctrl + Alt + T on your keyboard to open a new Terminal window.
Having done that, run the commands below to the first check for updates and then install PDFShuffler on your Linux system. (These commands are for Ubuntu 20.04, but other versions should not be too different from these).
Once the installation is complete, find the newly installed software in the Activities menu and run it. The default screen should look something like the image below.
The next step is to input your PDF file into the program by clicking the File button and selecting the Add option from the drop-down menu.
Once done, configure your extraction settings and split the file. The output should give you the desired extracted pages from the input document.
Using PDFtk
If you have a special appreciation for command-line programs rather than ones with graphical interfaces, then PDFtk is the way to go. It is an efficient CLI solution for users that need to extract specific pages from PDF files. Let us look at how you can install it on various Linux distributions and how to use it.
Go back to your Terminal window or open a new one and run the following commands if you use Ubuntu or Debian.
However, if you do not have the universe repository enabled, the command mentioned above will not work. You can enable this repository by running the command below.
Having done that, go back to the first command to install PDFtk.
If you are using Arch Linux or one of its variants, run the command below. (PDFtk is easily accessible through the community repository).
Similarly, if you are on openSUSE, run the command below to install PDFtk.
Lastly, if you have snap enabled, you can get this tool through a snap command as well.
Next, let us take a look at the usage of PDFtk. As we mentioned earlier, this is a CLI tool, so all you need to do is run a small command to get what you need.
Now, what is going on in this command? First, input.pdf is the document that needs to be split. The 3-4 parameter specifies page number range, 3 to 4. Next, we have the output filename, which is output_p3-4.pdf. Simple enough, and you should get the hang of it in no time.
However, you may not be looking to split a PDF file by a page number range; rather, extracting a bunch of particular pages into separate PDF files. Worry not, as you can do that through this tool as well. All you need to do is make a slight change in the command we mentioned earlier. This change is shown below.
With that done, you can split pages 3 and 4 and save them as output.pdf.
Conclusion
In this guide, we went into great depth about how you can extract pages from PDF files. We looked at a handy online tool, then a downloadable GUI-based program, and lastly, a command-line solution. The tools mentioned above are rich in terms of features and ought to get the job done easily.
About the author
Zeeman Memon
Hi there! I’m a Software Engineer by degree, Blogger by skills who loves to write about tech, develop websites & do SEO. You can reach out to me on LinkedIn.
Источник
How to extract pages from a PDF in Linux
Ebooks come in different formats, but the common one is PDF. Most of the ebook PDFs have hundreds of pages, and just like real books, with the help of a PDF reader navigating these pages is quite easy.
Suppose you are reading a PDF file and want to extract some specific pages from it and save it as a separate file; how would you do that? Well, it is a cinch! No need to get premium applications and tools to accomplish it.
This guide focuses on extracting a specific part from any PDF file and saving it with a different name in Linux. Though there are multiple ways to do this, I will be focusing on the less cluttered approach. So, let’s begin:
There are two main approaches:
- Extracting PDF pages through GUI
- Extracting PDF pages through the terminal
You can follow any method according to your convenience.
How to extract PDF pages in Linux via GUI:
This method is more like a trick for extracting pages from a PDF file. Most of the Linux distributions come with a PDF reader. So, let’s learn a step by step process of extracting pages using the default PDF reader of Ubuntu:\
Step 1:
Simply open your PDF file in the PDF reader. Now click on the menu button and as shown in the following image:
Step 2:
A menu will appear; now click on the “Print” button, a window will come out with print options. You can also use the shortcut keys “ctrl+p” to quickly get this window:
Step 3:
To extract pages in a separate file, click on the “File” option, a window will open, give the file name, and select a location to save it:
I am selecting “Documents” as the destination location:
Step 4:
These three output formats PDF, SVG, and Postscript check PDF:
Step 5:
In the “Range” section, check the “Pages” option and set the range of page numbers you want to extract. I am extracting the first five pages so that I would type “1-5”.
You can also extract any page from the PDF file by typing the page number and separating it by a comma. I am extracting pages number 10 and 11 along with a range for the first five pages.
Note that the page numbers I am typing are according to the PDF reader, not the book. Ensure that you enter the page numbers that the PDF reader indicates.
Step 6:
Once all the settings are done, click on the “Print” button, the file will be saved in the specified location:
How to extract PDF pages in Linux via terminal:
Many Linux users prefer to work with the terminal, but can you extract PDF pages from the terminal? Absolutely! It can be done; all you need a tool to install called PDFtk. To get PDFtk on Debian and Ubuntu, use the command given below:
For Arch Linux, use:
PDFtk can also be installed through snap:
Now, follow the below-mentioned syntax to use PDFtk tool for extracting pages from a PDF file:
- [sample.pdf] – Replace it with the file name from where you want to extract pages.
- [page_numbers] – Replace it with the range of page numbers, for example, “3-8”.
- [output_file_name.pdf] – Type the name of the output file of extracted pages.
Let’s understand it with an example:
$pdftk adv_bash_scripting.pdf cat 3 — 8 output
In the above command, I am extracting 6 pages (3 – 8) from a file “adv_bash_scripting.pdf” and saving extracted pages by the name of “extracted_adv_bash_scripting.pdf.” The extracted file will be saved in the same directory.
If you need to extract a specific page, then type the page number and separate them by a “space”:
$pdftk adv_bash_scripting.pdf cat 5 9 11 output
In the above command, I am extracting page numbers 5, 9, and 11 and saving them as “extracted_adv_bash_scripting_2”.
Conclusion:
You may occasionally need to extract some specific portion of a PDF file for several purposes. There are many ways to do it. Some are complex, and some are obsolete. This write-up is about how to extract pages from a PDF file in Linux through two simple methods.
The first method is a trick to extract a certain part of a PDF through Ubuntu’s default PDF reader. The second method is via terminal since many geeks prefer it. I used a tool called PDFtk to extract pages from a pdf file through the use of commands. Both methods are simple; you can choose any according to your convenience.
About the author
Sam U
I am a professional graphics designer with over 6 years of experience. Currently doing research in virtual reality, augmented reality and mixed reality.
I hardly watch movies but love to read tech related books and articles.
Источник
How To Split or Extract Particular Pages From A PDF File
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.
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:
On Debian, Ubuntu:
$ sudo apt install pdftk
Note: You need to enable [universe] repository in Ubuntu to install pdftk.
PDFtk is also available as snap package. Make sure your system has snap installed and run the following command to install PDFtk.
Usage
Once you installed PDFtk, open your Terminal and extract a range of pdf files as shown below.
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:
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.
Extract particular pages from PDF file using default PDF reader application
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.
Источник