How to Split PDF File on Ubuntu 18.04
Splitting PDF file into one PDF file per page or selecting specific pages into one PDF file can be done in Ubuntu in 2 ways, first with the default PDF reader application in Ubuntu, Document Viewer (Evince), and the second by using command line based application PDFtk (PDF toolkit).
Document Viewer
Splitting PDF file using the Document Viewer
- Open PDF file
- Click Print… or CTRL+P
- Choose Print to File
- Click File for output file name
- Choose Pages then enter the page number you want to split. For example page 10 enter 10, pages 5 to 10 enter 5-10
- Click Print
The drawback of Document Viewer is that when you want to split each page into one PDF file it will take a long time because you have to do it repeatedly. For example split PDF file containing 100 pages, must do Print to File up to 100 times.
PDFtk (PDF toolkit)
Splitting PDF files using command line based PDFtk
Install PDFtk on Ubuntu 18.04
1 | sudo snap install pdftk |
Create a pdftk symlink
1 | sudo ln -s /snap/pdftk/current/usr/bin/pdftk /usr/bin/pdftk |
Split one page (page 10) from a PDF file (fullpage.pdf)
1 | pdftk fullpage.pdf cat 10 output page10.pdf |
Split pages 5 to 10 of the PDF file
1 | pdftk fullpage.pdf cat 5-10 output page5-10.pdf |
If you want to split each page, create a simple bash script to run PDFtk repeatedly.
Create a bash script file
1 | nano split.sh |
Script to split each page of a PDF file with the name file fullpage.pdf which contains 100 pages.
1 2 3 4 5 6 | #!/bin/bash for page in {1..100} do pdftk fullpage.pdf cat $page output $page.pdf done |
Give execute privileges then run the script
1 2 | chmod u+x split.sh ./split.sh |
PDFtk can also be used to merge PDF files
1 | pdftk file1.pdf file2.pdf file3.pdf cat output output.pdf |
If you found this article helpful and would like to support my work, consider making a donation through PayPal. Your support helps me continue creating useful content and tutorials. Thank you!
Donate via PayPal: https://paypal.me/musaamin
Cool tutorial, thanks! That script to split a PDF into individual pages, in particular, is super useful.