QPDF

QPDF is both a software library and a free command-line program that can convert one PDF file to another equivalent PDF file. It is capable of performing transformations such as linearization (also known as web optimization or fast web viewing), encryption, and decryption of PDF files. It also has options for inspecting or checking PDF files, some of which are useful primarily to PDF developers. QPDF includes support for rotating, merging and splitting PDFs through the ability to copy objects from one PDF file into another and to manipulate the list of pages in a PDF file. QPDF is not capable of converting PDF into other formats.

The QPDF library also makes it possible to create PDF files from scratch. In this mode, the user is responsible for supplying all the contents of the file, while the QPDF library takes care of the syntactical representation of the objects, creation of cross references tables and, optionally, object streams, encryption, linearization, and other syntactic details.

QPDF is written in C++.