Solved

Is there any standalone comand-line tool to put a watermark on a pdf file ?

Posted on 2015-02-02
6
301 Views
Last Modified: 2015-02-02
Hi.

I'm looking for a command-line tool on Windows that I can call from my program that put a customized watermark (from an image I pass it by parameter) to a PDF file (that I would pass also by parameter). Does this exist ?

If not, is there a dll or something like this that I can call it from my PowerBuilder program for doing this?

Thank you.
0
Comment
Question by:gplana
  • 3
  • 2
6 Comments
 
LVL 37

Expert Comment

by:Bing CISM / CISSP
ID: 40583768
FYI - 5 Tools to Add Watermark or Logo to PDF Files
http://www.aboutonlinetips.com/how-to-add-watermark-to-pdf/

i guess the open source one (http://sourceforge.net/projects/jpdftweak) give you some hints if the source code can be legally accessed and used.
0
 
LVL 37

Expert Comment

by:Bing CISM / CISSP
ID: 40583769
FYI - 5 Tools to Add Watermark or Logo to PDF Files
http://www.aboutonlinetips.com/how-to-add-watermark-to-pdf/

i guess the open source one (http://sourceforge.net/projects/jpdftweak) may give you some hints if the source code can be legally accessed and used.
0
 
LVL 37

Expert Comment

by:Bing CISM / CISSP
ID: 40583771
sorry for the repeated post (though a typo fixed).
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 52

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
ID: 40584322
The PDF Toolkit (PDFtk) is an excellent (free!) product that can do it. It comes in both command line and GUI versions. The command line version is called PDFtk Server and may be downloaded here:
http://www.pdflabs.com/tools/pdftk-server/

Don't be misled by "Server" in the name. I don't know why they called it that, but it's just an executable (pdftk.exe, with a supporting DLL, libiconv2.dll) that runs on XP, Vista, W7, and W8 (i.e., it does not have to run on a "server" OS). I don't know PowerBuilder, but as long as it can make a command line call to an EXE, you'll be fine. Here's an EE article showing a call to it in from another programming language (AutoHotkey):
http://www.experts-exchange.com/Web_Development/Document_Imaging/A_11211-How-To-Split-Rename-Move-a-Batch-of-PDF-Files-Based-on-Contents-of-the-Files.html

Look at the Man Page in the <doc> folder and you'll see the background parameter, as follows:
background < background PDF filename | - | PROMPT >

Applies a PDF watermark to the background of a single input PDF. Pass the background PDF’s filename after background like so:

pdftk in.pdf background back.pdf output out.pdf

Pdftk uses only the first page from the background PDF and applies it to every page of the input PDF. This page is scaled and rotated as needed to fit the input page. You can use - to pass a background PDF into pdftk via stdin.

If the input PDF does not have a transparent background (such as a PDF created from page scans) then the resulting background won’t be visible — use the stamp operation instead.
Note the reference to the stamp param — and there's also a multistamp param:
stamp < stamp PDF filename | - | PROMPT >

This behaves just like the background operation except it overlays the stamp PDF page on top of the input PDF document’s pages. This works best if the stamp PDF page has a transparent background.

multistamp < multistamp PDF filename | - | PROMPT >

Same as the stamp operation, but applies each page of the stamp PDF to the corresponding page of the input PDF. If the input PDF has more pages than the stamp PDF, then the final stamp page is repeated across these remaining pages in the input PDF.
Regards, Joe
0
 
LVL 15

Author Closing Comment

by:gplana
ID: 40584338
Excellent. This is exactly what I needed. So on the machine where I have to run this, I have just to copy pdftk.exe and libiconv2.dll inside my application folder? I mean, I don't need to execute the installer that I have downloaded on the link you provided to me?

Thanks.
0
 
LVL 52

Expert Comment

by:Joe Winograd, EE MVE
ID: 40584357
Yes, exactly! Simply put the EXE and the DLL in the folder with your app — no need to run the installer on the target machine. But make sure you're in license compliance:
https://www.pdflabs.com/docs/pdftk-license/

Good luck with your program! Regards, Joe
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now