Solved

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

Posted on 2015-02-02
6
284 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 51

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 51

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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 fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

757 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

18 Experts available now in Live!

Get 1:1 Help Now