Command line tools to edit pdfs
Programs such as Imagemagick (the "convert" command), PDFjam, Ghostscript and PDFSAM provide options to edit PDFs, such as merging, splitting, rotating PDFs, or converting other file formats to PDF.
Contents
Join PDFs into one file
Install Imagemagick (or log on to Sverdrup), and use the "convert" command:
convert infile1.pdf infile2.pdf outfile.pdf
If the quality is reduced, use the -density flag (the higher number afterwards, the better. 600 is good). If you are converting from a JPEG/MIFF/PNG file to pdf, use -quality instead.
convert -density 600 infile1.pdf infile2.pdf outfile.pdf
Join picture files into one file
convert -quality 600 infile1.jpg infile2.jpg outfile.pdf
Alternative way to do this in Windows
In Windows, files can be merged using Adobe Acrobat Pro (on a remote desktop to win.uio.no), choose "Merge PDFs into one file".
Extract pages from PDF
Install PDFjam to extract pages from a PDF into another PDF.
pdfjam -o outfile.pdf infile.pdf wantedpage1,wantedpage2
Join PDFs into one file - several sheets per page
After convert has joined several PDFs, PDFjam can be used to put several sheets on one page. Here, I prepare a 12-page PDFs into one-page PDF (3 columns, 4 rows), before printing:
pdfjam --nup 3x4 --landscape my_12_slides.pdf --outfile my_1_page_handout.pdf
Rotate pages
Contained in PDFjam is a lot of useful commands, such as pdf90 which rotates your file:
pdf90 operates on one or more PDF files, and (either with the '--batch' option or with '--outfile DIR' where 'DIR' is a directory) the resulting files have the suffix 'rotated90' applied to their names by default. To change the suffix, use the '--suffix' option, for example
pdf90 --suffix '-turned' --batch myfile1.pdf myfile2.pdf
will result in files named 'myfile1-turned.pdf' and 'myfile2-turned.pdf'. (From http://linux.die.net/man/1/pdf90)