Adding a header and footer

Adding a header and footer to a set of slides

pdftk slides.pdf stamp footer.pdf output print.pdf

You can also take a look to the documentation for background and multibackground keywords

more ...

Adding bookmarks using GS

gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in-*.pdf pdfmarks

Where out.pdf is the generated PDF, in- * .pdf are the input PDFs, and pdfmarks is a text file with contents like:

[/Title (Title Page) /Page 1 /OUT pdfmark
[/Title (Table of Contents) /Page 3 /OUT pdfmark

Nice and ...

more ...

Extract pages

You can extract the pages from a pdf (or from several) and join them in another one:

pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 output combined.pdf

You can extract pages from a pdf using Ghostscript:

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dFirstPage=1 -dLastPage=7 -o extracted ...
more ...

Reduce the size

You can use GhostScript for reducing the size of a pdf

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH  -dQUIET -sOutputFile=hector_nuba_.pdf hector_nuba.pdf

There are several options:

-dPDFSETTINGS=/screen  (75ppp)
-dPDFSETTINGS=/ebook   (150ppp)
-dPDFSETTINGS=/printer (300ppp)

If you use the printer option you may get a ...

more ...

Remove password

You can use ghostscript for removing the password of a PDF

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf
more ...

Trace all the fonts

You can trace all the fonts in a pdf using this command:

gs -o file-with-outlines.pdf -dNoOutputFonts -sDEVICE=pdfwrite file.pdf
more ...

Adding margins to an image to match a A4 pdf

Adding margins for a A4 pdf

convert montado000.jpg -bordercolor white -border 70 -page A4 salida.pdf

Take into account that the order of the parameters is important and -bordercolor should appear before of -border or everything will be grey.

more ...

Split an A3 in 4 A4

A trick for splitting an A3 in 4 A4

pdftk mapA3.pdf burst output pgmapa3%d.pdf
convert -density 600x600 -limit memory 32 pgmapa31.pdf pgmapa31.jpg
convert -verbose -crop 3508x4960 pgmapa31.jpg pgmapa31_%02d.jpg
convert -page A4 -resize '2480x3508^>' -extent 2620x3706 pgmapa31_0* pgmapa4.pdf
gs -sDEVICE=pdfwrite -dNOPAUSE ...
more ...