Category: pdf

Split multi-paged PDF file in to individual PDF files

You might come across a situation where you have a PDF file with multiple pages and you’d like to split each page in to each PDF file. Sound pretty tedious task right?It’s just as simple as executing a single command. All you gotta do is, make sure you have pdftk (PDF Tool Kit) installed on your Linux machine.

If you do not have the pdftk installed, follow the below steps:

For(Ubuntu/Debian)

sudo apt update
sudo apt install pdftk 

For(CentOS/Fedora), follow the instructions in the link below to install it:

https://www.pdflabs.com/docs/install-pdftk-on-redhat-or-centos/

Once installed, use the below command to split a single multi-paged PDF file to individual PDF files with each page

$pdftk your_multi-page_file.pdf burst

This will split each page from multi-page PDF file to each individual PDF file.

Similarly, to merge few selected PDF files in to one PDF file, use the following command:

$pdftk file1.pdf file2.pdf cat output mergedfile.pdf

If you want to merge all the PDF files in a specified directory, you may use the wild card character(*) as follows:

$pdftk *.pdf cat output mergedfile.pdf

‘*’ implies all the files with .pdf extension

You may find few more tips on dealing with PDF files here