Monday, June 25, 2007

Dealing with PDF with pdftk

pdftk is a tool that can help you to manipulate PDF files even though you don't have Acrobat installed. The most common usage is to merge/split PDF files.

General syntax:

pdftk <input PDF files> cat [ <input PDF pages> ] output <output PDF filename>

  • Extract page 1-3 from in1.pdf and save as out.pdf
    pdfhk A=in1.pdf cat A1-3 output out.pdf
  • Extract page 1-3 from in1.pdf, page 4-6 from in2.pdf, merge it and save as out.pdf
    pdfhk A=in1.pdf B=in2.pdf cat A1-3 B4-6 output out.pdf
  • Extract page1 from in2.pdf, and every even pages (2,4,6...) of in1.pdf, merge it and save as out.pdf
    pdftk A=in1.pdf B=in2.pdf cat B1 A1-endeven output out.pdf
Actually pdftk can also rotate, encrypt/decrypt and do more. Details usage can refer the link below.


No comments: