Skip to content

Instantly share code, notes, and snippets.

@mrdwab
Created August 8, 2014 10:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrdwab/d0e8fd9d8a3a22d12d5a to your computer and use it in GitHub Desktop.
Save mrdwab/d0e8fd9d8a3a22d12d5a to your computer and use it in GitHub Desktop.
Use PDFtk to add a "stamp" or a "background" to a PDF and restrict editing/copying.
@echo off
if [%1]==[] goto :eof
:loop
pdftk %1 stamp back.pdf output "%~dpn1_new%~x1" owner_pw somepasswordyouwant
shift
if not [%1]==[] goto loop
@mrdwab
Copy link
Author

mrdwab commented Aug 8, 2014

To use this:

  • Download and install PDFtk server.
  • Copy the "pdftk.exe" and "libiconv2.dll" files from the installation directory into the same folder that you saved this batch file.
  • Create a file named "back.pdf" to use as the background or stamp and save that in the same directory as this batch file.
  • Drag files you want to protect onto pdfWatermarkEncrypt.bat and wait for the output to be produced.

The files would be named with the original name plus _new.

This solution was taken from: http://davidejones.com/blog/266-pdf-watermarking-pdftk/

@adityazainud
Copy link

Hello.

If I code one file at a time using:

pdftk 610221-02-49-A-R4.pdf stamp EDITTANGGAL_STEMPEL.pdf output x.pdf
It worked

But when I tried the code above, no file was created.

Why?

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment