PDFtk: A tool to split PDF files from the terminal

pdftk

El finding PDF documents has become commonplaceWell, they won't let me lie just a few years ago finding a document in this type of format was too much so having a software for reading it was not something usual, much less for editing.

At work I usually use the scanner a lot and send documents directly to my email. either to do some editing or simply send them, there I have no problem because the company makes all the software available to us so I do not have the ability to add or remove more software.

The problem lies when I have to do the work at home, as many of you will know Adobe has not extended its tools for Linux, so it is necessary to use a third-party application.

This is where an application that helps us with these tasks comes in, which unlike others from my point of view has everything you need not to say that it is the most complete.

About PDFtk

PDFtk is a front end of the iText library, PDFtk is an open source and cross-platform tool what is oriented for handling PDF documents. This application allows us to manipulate PDF documents and what we can do is divide, combine, encrypt, decrypt, decompress, recompress and repair.

It can also be used to manipulate watermarks, metadata, or to fill PDF forms with FDF (Forms Data Format) or XFDF (XML Form Data) data.

Between Its main characteristics can be highlighted:

  • Merge multiple PDF files into one
  • Insert certain pages from one PDF to another
  • Rearrange, delete pages, rotate pages within PDF
  • Split a single PDF document into multiple files
  • Password protect PDF document
  • Disable Priting functionality and more

How to install PDFtk on Linux?

This application can be found to install easily on most Linux distributions, so its availability should not represent any problem.

To install PDFtk on Linux We must open terminal and type the commands according to your Linux distribution.

Si you are using Debian, Ubuntu or some derivative of these you must type this command:

sudo apt-get install pdftk

In the case of Arch Linux, users will not be able to install the software from the main Arch Linux sources, so use of AUR is required.

sudo pacman -S git
git clone https://aur.archlinux.org/pdftk.git

cd pdftk

Inside the PDFtk source folder, they must start the compilation process by executing:

makepkg

In the case of users of Fedora is necessary to download a package which can be done by typing these commands:

wget http://ftp.gwdg.de/pub/opensuse/distribution/leap/42.3/repo/oss/suse/x86_64/pdftk-2.02-10.1.x86_64.rpm
wget http://ftp.gwdg.de/pub/opensuse/distribution/leap/42.3/repo/oss/suse/x86_64/libgcj48-4.8.5-24.14.x86_64.rpm

Done the download now we must install the packages just obtained with:

sudo dnf install libgcj48-4.8.5-24.14.x86_64.rpm pdftk-2.02-10.1.x86_64.rpm -y

If you are Main_PDF

using any of the versions of orpenSUSE the application you install with:

sudo zypper install pdftk

How to use PDFtk on Linux?

As mentioned previously, PDFTk has several editing options so its use depends on you.

For merge two PDF documents into one new PDF, we execute:

pdftk 1.pdf 2.pdf cat output pdfresultante.pdf

O if you want to join all the pdfs that are in the same folder:

pdftk * .pdf cat output combined.pdf

Now if they want to remove a page from the document, for example, page 5 and must indicate the end of the document with -end

pdftk documento.pdf cat 1-4 20-end output pdfresultante.pdf

Split a PDF document page by page:

pdftk documento.pdf burst

For rotate a document:

pdftk documento.pdf cat 1-endS output out.pdf

Here we are indicating that all the pages rotate towards the South, that is, we are going to rotate the pages 180 degrees if you want to rotate the document 90 degrees do it with E and if you want 270 degrees with W.

If you want to know more about the commands for use and some examples of this tool you can visit the following link


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.