Table of Contents

PDF editing on Linux CLI

Merge PDF

You can easily merge two or more PDF's to one on Linux CLI - private and secure, without having the risk that any suspicious webservices crawls your data.

1st. option: Therefore install the package poppler-utils.

sudo apt install poppler-utils

Then use pdfunite:

pdfunite <inputfile-1> <inputfile-2> [<inputfile-x>] <final-file>

2nd. option: Otherwise you can use pdftk:

sudo apt install pdftk

With this command structure:

pdftk <inputfile-1> <inputfile-2> cat output <final-file>

Paritally sourced from linuxopsys.com - Merge PDF

Rotate PDF

It is also easy to rotate a PDF from CLI. Therefore install pdftk from the upper section.

→ Then use this command to rotate clockwise:

pdftk <inputfile-1> cat 1east end output <final-file>

→ To rotate anti-clockwise use this command:

pdftk <inputfile-1> cat 1west end output <final-file>

By replacing e.g. 1east with other cardinal directions, it is also possible to change a page by 180°.

Delete page from PDF

It is also easy to delete the last page from a PDF via CLI. Therefore also install pdftk from the upper section.

→ Then use this command to delete the last page:

pdftk <inputfile-1> cat 1-r2 output <final-file>