Ubuntu – How to split a PDF onto multiple pages on command line

command linepdfUbuntu

How can I split (tile?) one huge PDF onto multiple pages? The result can be one PDF with multiple A4 pages or several A4 PDFs.

Although I generated the PDF with dot I would like to have this problem solved in general — or at least on a standard Ubuntu (eg. 12.04).

The input PDF has been generated by Graphviz dot, eg. dot -Tpdf sample.dot > sample.pdf. When I did not add a size="8,11"; ratio="fill"; to the graph the output PDF is very large. If I add the size/fill-hints dot only scaled things down for me.

Lets give you one example:

If my original PDF was huge like this:

+-------------------+
|                   |
|  O                |
|  :                |
|  :..........C     |
|  :        :       |
|  :        :       |
|  :        :       |
|  :        G       |
|  :        :       |
|  :        :       |
|  :        :       |
|  :        :       |
|  U        :       |
|           B       |
|                   |
+-------------------+

This should be split by a command like

pdftile sample.pdf -x 2 -y 3 > sample-2x3.pdf

into

+---------+---------+
|         |         |
|  O      |         |
|  :      |         |
|  :......|...C     |
|  :      | :       |
+---------+---------+
|  :      | :       |
|  :      | :       |
|  :      | G       |
|  :      | :       |
|  :      | :       |
+---------+---------+
|  :      | :       |
|  :      | :       |
|  U      | :       |
|         | B       |
|         |         |
+---------+---------+

I looked into the pdfjam toolset but it seems this feature is not implemented there. I would like it to be a command line tool — and it should be automated, not manually

Best Answer

It looks like pdfposter can do this.

Related Question