These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Apply Watermark with VBA

danlopez007
Registered: Feb 14 2008
Posts: 10

I have a situation where I print one copy without a watermark and then I have a watermark file that I apply and print another copy. I would like to do this programmatically in VBA. Using the SDK I got it to print but I can't find anything in there about applying watermarks. At this point I would even try a Java Script.

Can anyone help this poor sole find his way?

Thanks

My Product Information:
Acrobat Standard 7.0.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can apply watermarks with JavaScript using two functions, "this.addWatermarkFromFile()" and "this.addWatermarkFromText()", and you can do it from your VBA program.

Here's the method:

1. Create a folder level JavaScript file with a function for adding your watermark. If you need to use "this.addWatermarkFromFile()" you'll have to make it a trusted function. Find details for this code in the Acrobat JavaScript Reference.

2. Use the PDDoc.GetJSObject() function to get direct access to the Acrobat JavaScript Envronment and call the function for adding your watermark.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

fragher1975
Registered: Jun 29 2009
Posts: 1
Hello,
I have almost 4000 TIF file in a directory and I should create 4000 .pdf file and add a watermark in ever page from a file .bmp.
I use acrobat 7.0 and I would use a VBA routine from MS EXCEL.
Is it possible? What do I need?
I don't know JavaScript.
Thanx, Francesco.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes this is possible. But there is an easier way. Use a batch process. The "Advanced > Document Processing > Batch Process..." menu item in Acrobat Professional 8 and 9. A batch process can both convert the TIFFs to PDF and add a watermark. No scripting necessary.Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

klovett
Registered: Sep 12 2011
Posts: 1
Using VBA in Excel, I create several pdf documents as an output from Excel. I want to add a jpg image as background to the pdfs. I created an Action to do this, but I want to fully automate the process. Can I call the doc object from within Excel, or is this a post-export process? Code suggestions are greatly appreciated. thx kdl

kdl