Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Adding watermark with datestamp via JS
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Adding watermark with datestamp via JS

 Post Reply Post Reply
Author
pickman View Drop Down
New Member
New Member


Joined: 19 Sep 2013
Points: 5
Post Options Post Options   Quote pickman Quote  Post ReplyReply Direct Link To This Post Topic: Adding watermark with datestamp via JS
    Posted: 19 Sep 2013 at 4:33pm
Hello, I'm a self-professed failure when it comes to JavaScript and I need some help with a script.
 
What I'm wanting to do is add a watermark to every page of a scanned, OCR'd document that says:
 
Deposit
mm-dd-yy
 
in the top right corner, offset by about a half an inch from the edge of the page. mm-dd-yy is the current date. I don't want that field to update when anyone opens the document, just the one time I run the script as part of a batch.
 
I have a saved watermark process to do this, but I have to update the date every time and go through a few steps to get it done. I'd like a script so I can add it as part of the batch process that runs the document through OCR, then deletes blank pages (anything where words == 0). I've got the OCR and deleting pages part of the batch down, it's just this javascript that's keeping me down.
 
If anyone can offer some help with this script, I'd really appreciate it.


Edited by pickman - 19 Sep 2013 at 4:51pm
Awake, arise, or be forever fallen!
Back to Top
pickman View Drop Down
New Member
New Member


Joined: 19 Sep 2013
Points: 5
Post Options Post Options   Quote pickman Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 2013 at 5:12pm
I should note, as it stands I've got:
 
this.addWatermarkFromText({
 cText: "Deposit\r//current date code//",
 nTextAlign:app.constants.align.center,
 cFont: "Arial",
 nFontSize:12,
 aColor: color.black,
 nOpacity: 0.25
 nHorizValue: -14, nVertValue: -14
});
I just don't have any clue how to add the current datestamp where I've got //current date code// in the script.
Awake, arise, or be forever fallen!
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4109
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 2013 at 6:34pm
You can access the system's date object and format it as needed.
 
var oDate = new Date(); // get the systems date object
var cDate = util.printd("mm-dd-yy", oDate); // format the date string
var cDepositText = "Deposit\r" + cDate; // build deposit string;
this.addWatermarkFromText({
 cText: cDepositText,
 nTextAlign:app.constants.align.center,
 cFont: "Arial",
 nFontSize:12,
 aColor: color.black,
 nOpacity: 0.25,
 nHorizValue: -14, nVertValue: -14
});


Edited by gkaiseril - 19 Sep 2013 at 6:36pm
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.000 seconds.