User Tools

Site Tools


pdftk_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
pdftk_notes [2021/05/06 20:51] – [store a pdf without password] rajupdftk_notes [2023/08/14 21:34] – [replace a page with another pdf] raju
Line 1: Line 1:
 +
 +
 +==== 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.
 +
 +<code>
 +pdftk A=initial.pdf B=insertAsPg16.pdf cat A1-15 B1 A17-end output final.pdf
 +</code>
 +
 +Tested using
 +
 +<code>
 +% pdftk --version
 +
 +pdftk 2.01 a Handy Tool for Manipulating PDF Documents
 +Copyright (C) 2003-13, Sid Steward - Please Visit: www.pdftk.com
 +This is free software; see the source code for copying conditions. There is
 +NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 +</code>
 +
 +==== rotate pages by 180 degrees ====
 +<code>
 +pdftk in.pdf cat 1-endsouth output out.pdf
 +</code>
 +
 +Ref:- https://people.uleth.ca/~daniel.odonnell/blog/rotating-one-or-more-pages-in-a-pdf-in-linux - where I found the above solution.
 +
 ==== store a pdf without password ==== ==== store a pdf without password ====
 tags | remove password pdf tags | remove password pdf
Line 4: Line 31:
 <code> <code>
 qpdf --password=YOURPASSWORD --decrypt input.pdf output.pdf qpdf --password=YOURPASSWORD --decrypt input.pdf output.pdf
 +</code>
 +If the password has some special characters, quote it.
  
 +<code>
 +qpdf --password="YOURPASSWORD" --decrypt input.pdf output.pdf
 +</code>
 +
 +<code>
 pdftk secured.pdf input_pw YOURPASSWORD output unsecured.pdf pdftk secured.pdf input_pw YOURPASSWORD output unsecured.pdf
 </code> </code>
Line 11: Line 45:
  
 Ref:- https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ - Mentions qpdf; gives more alternatives. Ref:- https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ - Mentions qpdf; gives more alternatives.
 +
 +==== encrypt a pdf with password ====
 +<code>
 +pdftk in.pdf output out.pdf user_pw foo
 +</code>
 +
 +Ref:- http://askubuntu.com/questions/258848/is-there-a-tool-that-can-add-a-password-to-a-pdf-file
 +
 +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 <nowiki>http://www.adobe.com/content/dam/Adobe/en/products/acrobat/pdfs/adobe-acrobat-xi-protect-pdf-file-with-permissions-tutorial-ue.pdf</nowiki>. 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 ==== ==== make two copies of the same document ====
Line 18: Line 61:
  
 See also: https://superuser.com/questions/600877/how-do-i-duplicate-pages-within-pdf-files-automatically - has a script to duplicate it by page (as in 1,1,2,2,...) See also: https://superuser.com/questions/600877/how-do-i-duplicate-pages-within-pdf-files-automatically - has a script to duplicate it by page (as in 1,1,2,2,...)
 +
 +==== debian package ====
 +  * pdftk-java
 +
 +==== external links ====
 +  * Enricon Zini talks about using pdfk and inkscape to add signatures to pdf documents - http://www.enricozini.org/blog/2016/pdftk-inkscape/
  
pdftk_notes.txt · Last modified: 2024/02/15 04:34 by raju