User Tools

Site Tools


extract some pages

To get pages 11-19 (inclusive on both sides) of a pdf file

pdftk A=in.pdf cat A11-19 output out.pdf

Tested using

 % pdftk --version
pdftk port to java 3.3.2 a Handy Tool for Manipulating PDF Documents

replace a page with another pdf

To replace pg-16 of a pdf with another pdf. Assume that the later consists of only one single page.

pdftk A=initial.pdf B=insertAsPg16.pdf cat A1-15 B1 A17-end output final.pdf

Tested using

% pdftk --version

pdftk 2.01 a Handy Tool for Manipulating PDF Documents
Copyright (C) 2003-13, Sid Steward - Please Visit:
This is free software; see the source code for copying conditions. There is

rotate pages by 180 degrees

pdftk in.pdf cat 1-endsouth output out.pdf

Ref:- - where I found the above solution.

store a pdf without password

tags | remove password pdf

qpdf --password=YOURPASSWORD --decrypt input.pdf output.pdf

If the password has some special characters, quote it.

qpdf --password="YOURPASSWORD" --decrypt input.pdf output.pdf
pdftk secured.pdf input_pw YOURPASSWORD output unsecured.pdf

Note:- If possible switch to using qpdf instead of pdftk. There were couple of instances where the pdftk command failed and qpdf succeeded.

Ref:- - Mentions qpdf; gives more alternatives.

encrypt a pdf with password

pdftk in.pdf output out.pdf user_pw foo


Note:- I was unable to encrypt a pdf file using Adobe Reader X1 Version 11.0.13 . I could not find the “Tools pane” described in I also tried File → Properties → Security after opening the file. However all the options in that window are greyed out. So I can't add a password from there as well. I was told that Adobe Standard can do this but it costs money whereas pdftk is free. In the end, using pdftk was a no brainer.

make two copies of the same document

pdftk in.pdf cat 1-end 1-end output out.pdf

See also: - has a script to duplicate it by page (as in 1,1,2,2,…)

debian package

  • pdftk-java
pdftk_notes.txt · Last modified: 2024/02/15 04:34 by raju