Search code examples
pdfimagemagickpdftk

Clone PDF file in a single page


I've got a PDF file which is exactly 1/5 of the size of an A4 page, and a script to convert it into a single A4 page by appending it repeatedly. The problem is that ImageMagick only works with bitmap graphics, and my PDF contains text and detailed vector graphics. The result is therefore loss of text data, much bigger file size, and worse print output.

I'd like to be able to do the same as the line convert -density 1200 $pdf_file $pdf_file $pdf_file $pdf_file $pdf_file +append $a4_file without rasterising the vector graphics.


Solution

  • pdftk and pdfnup are really most excellent!

    Pseudocode version of the finished script:

    for each file:
        inkscape --export-pdf
        pdftk (pdf-file x 5) cat output 5.pdf
        pdfnup 5.pdf --nup 5x1 --paper a4paper --orient landscape --outfile {recto,verso}.pdf
    
    pdftk R=recto.pdf V=verso.pdf cat R1W V1E output bookmark.pdf