Solved

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

Posted on 2015-02-02
6
388 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 37

Expert Comment

by:bbao
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:bbao
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:bbao
ID: 40583771
sorry for the repeated post (though a typo fixed).
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 54

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 54

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Android development question 2 108
BATCH to EXE Converter 2 99
junit initializtion error 2 20
powershell script to rename files in specified folder 16 35
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.

734 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