Adobe Acrobat Reader (For Windows)

Talk about Adobe Acrobat PDF reader (Windows only). Acrobat is the de facto standard used to create PDF files, present multiple documents in a PDF Portfolio, and even add multimedia. All in a single file. 


Keywords Adobe, Acrobat, Reader, Windows, Print, File, Name, pdf, Document

Print File Name with pdf Document

Goto page 1, 2, 3, 4  Next
   Adobe Acrobat Reader (For Windows) Forum Index -> Adobe Acrobat Reader (For Windows)
 
AuthorMessage
Lloyd_G_Guenther (A_T) adobeforums.com
Guest





PostPosted: Wed Aug 30, 2006 6:52 pm    Post subject: Print File Name with pdf Document



In order to have an audit trail / track a document, I want to print the file name as a header or footer when printing the documents. How can this be done?
Back to top
Jeffrey_Kuhn (A_T) adobeforums.com
Guest





PostPosted: Thu Nov 09, 2006 5:14 pm    Post subject: Re: Print File Name with pdf Document



I have exactly the same question; it's unimaginable that this can't be done.
Back to top
Leonard_Rosenthol (A_T) adobeforums.com
Guest





PostPosted: Mon Nov 13, 2006 1:15 pm    Post subject: Re: Print File Name with pdf Document



Add some JavaScript to your document as a "Will print" event.

Details in the Acrobat JavaScript Guide.

Leonard
Back to top
Jeffrey_Kuhn (A_T) adobeforums.com
Guest





PostPosted: Mon Nov 13, 2006 4:26 pm    Post subject: Re: Print File Name with pdf Document

Ok, thanks, but I don't know JavaScript, and even if I did your answer suggests that it needs to be done de novo for each document for which you need this information. We create many documents each day from a web-based banking application, and it would be great if Acrobat would simply handle this. I'm amazed Adobe hasn't built this in.

If I've misunderstood the custom nature of your solution, please let me know. And if you'd care to toss in some JavaScript, great!

:)

Thanks.
Back to top
Leonard_Rosenthol (A_T) adobeforums.com
Guest





PostPosted: Mon Nov 13, 2006 6:46 pm    Post subject: Re: Print File Name with pdf Document

I read your question as how to do that for a particular document - so yes, the embedded JavaScript would need to be included in that document. You could certainly have this done on the server as well, as part of your creation process.

As to have Acrobat do this - although Acrobat itself doesn't include this functionality - I believe there are some 3rd party plugins for Acrobat that can add this.

Leonard
Back to top
Reinhard_Franke (A_T) adobeforums.com
Guest





PostPosted: Mon Nov 13, 2006 9:13 pm    Post subject: Re: Print File Name with pdf Document

Attached a simple JS that will do it. Copy it into Notepad and save it in your Acrobat \Javascript folder. Next time you start Acrobat you will a have menuitem "Print with Footer" direct above Print.

It put the values into fields at the footer. That may took some time. Then it displays the print-dialog and finaly you can choose if you want to remove the fields or not.

Enjoy, Reinhard

PrintWithFooter.js
-------------------------------

app.addMenuItem({cName:"Print with Footer", cParent:"File", nPos:20, cExec:"PrtFooter();"});

//Print bookmarked Pages
function PrtFooter()
{
for (var p = 0; p < this.numPages; p++)
{
var fd = this.addField("Date", "text", p, [10,10, 300,28]);
fd.textSize=8; fd.value = "Date: " + util.printd("yyyy/mmm/dd", new Date()) + " (" + this.path +")"
var fp = this.addField(String("page"+p+1), "text", p, [330,10,280,28]);
fp.textSize=8; fp.value = "Page: " + String(p+1)+ "/" + this.numPages;
}
app.execMenuItem("Print");
var OK = app.alert("Delete Date / Filename?",2,2);
if (OK == 4) {
var x = removeField("Date");
for (var p = 0; p < this.numPages; p++)
{
var x = removeField(String("page"+p+1));
} }
}
Back to top
Jeffrey_Kuhn (A_T) adobeforums.com
Guest





PostPosted: Tue Nov 14, 2006 1:30 am    Post subject: Re: Print File Name with pdf Document

Thank you Reinhard! You were kind to do this; but if I may ask a favor, can I get a version that just prints the date and the file name? I don't need the file path, since it's very long anyway.

Also, this script crashes when one chooses the "yes" option on the remove dialog.

Many thanks
Back to top
Reinhard_Franke (A_T) adobeforums.com
Guest





PostPosted: Wed Nov 15, 2006 9:55 pm    Post subject: Re: Print File Name with pdf Document

Attached an updated Script. It gives you a menu for Set/Remove Footer. Then you can Set - Print - Remove.

HTH, Reinhard

PrintWithFooter.js
-------------------------------

app.addSubMenu({ cName: "Footer",cUser: "Set/Remove Footer", cParent: "File", nPos: 20 });

app.addMenuItem({ cName: "Set Date Time (Filename)", cParent: "Footer", cExec: "SetFooter(1)"});
app.addMenuItem({ cName: "Set Page ", cParent: "Footer", cExec: "SetFooter(2)"});
app.addMenuItem({ cName: "Set Both", cParent: "Footer", cExec: "SetFooter(3)"});

app.addMenuItem({ cName: "-------------------------------", cParent: "Footer",cExec: "{}"});

app.addMenuItem({ cName: "Remove Date Time (Filename)", cParent: "Footer", cExec: "RemoveFooter(1)"});
app.addMenuItem({ cName: "Remove Page", cParent: "Footer", cExec: "RemoveFooter(2)"});
app.addMenuItem({ cName: "Remove Both", cParent: "Footer", cExec: "RemoveFooter(3)"});

function SetFooter(ARG)
{
var re = /.*\/|\.pdf$/ig;
var FileNM = this.path.replace(re,"")+".pdf";
var Path = this.path;
var AcDate = new Date();
for (var p = 0; p < this.numPages; p++) { if (ARG==1 || ARG==3) {var fd = this.addField("xftDate", "text", p, [30,15, 290,30]);
fd.textSize=6; fd.value = util.printd("yyyy/mmm/dd, HH:MM", AcDate) + " (" + FileNM +")"; }
if (ARG==2 || ARG==3){var fp = this.addField(String("xftPage"+p+1), "text", p, [350,15,300,30]);
fp.textSize=6; fp.value = "Page: " + String(p+1)+ "/" + this.numPages; }
} }

function RemoveFooter(ARG)
{
if (ARG==1 || ARG==3) {var x = this.removeField("xftDate");}
if (ARG==1 || ARG==3) {for (var p = 0; p < this.numPages; p++)
{
var x = this.removeField(String("xftPage"+p+1)); }
} }
Back to top
Reinhard_Franke (A_T) adobeforums.com
Guest





PostPosted: Thu Nov 16, 2006 1:17 pm    Post subject: Re: Print File Name with pdf Document

OK! Did a little bit more so it is usable for myself.

Now you can choose if you want to have the "Date Time (Filename" footer want to have left, center, or right aligned.

The code has been updated:
- now it really cnter the boxes page for page.
- the first box (Date ...) uses the total width of the page. So it also useable if you want to have a selfmade footer note, something like "First Draft from ....". You have only to edit one box on one page, then it will be displayed on all pages.

- if you want to remove you can use allways "Remove both". It's only work a little bit longer in bigg files.

br, Reinhard

PS to other scripters: If someone has time he may improve the script.
The general settings could be done on a extra page (like general Dateformat, general Texthigh, ..... Then this can saved in global.js. So all the user defined settings are stored and retrieveable. That would Adobe save work. Adobe should set up a "Acrobat Scripts & Scraps" forum, where (freetime-)scripter can publish and discuss scripts.

Edit: ... and where it is also poosible to publish scripts without to have to format by yourselft, so thath it is readable!

SetRemoveFooter.js (<-Save in ...\javascript) -----------------------------------------------

// SetRemoveFooter
app.addSubMenu({ cName: "Footer",cUser: "Set/Remove Footer", cParent: "File", nPos: 20 });

app.addMenuItem({ cName: "Set Date Time (Filename)", cParent: "Footer", cExec: "SetFooter(1)"});
app.addMenuItem({ cName: " -> Set Date .... centered", cParent: "Footer", cExec: "SetFooter(2)"});
app.addMenuItem({ cName: " -> Set Date .... right", cParent: "Footer", cExec: "SetFooter(3)"});
app.addMenuItem({ cName: "Set Page ", cParent: "Footer", cExec: "SetFooter(4)"});
app.addMenuItem({ cName: "Set Both", cParent: "Footer", cExec: "SetFooter(5)"});


app.addMenuItem({ cName: "-------------------------------", cParent: "Footer",cExec: "{}"});


app.addMenuItem({ cName: "Remove Both", cParent: "Footer", cExec: "RemoveFooter(5)"});
app.addMenuItem({ cName: "Remove Date Time (Filename)", cParent: "Footer", cExec: "RemoveFooter(1)"});
app.addMenuItem({ cName: "Remove Page", cParent: "Footer", cExec: "RemoveFooter(4)"});


//Set/remove Footer
function SetFooter(ARG)
{
var re = /.*\/|\.pdf$/ig;
var FileNM = "..\" + this.path.replace(re,"")+".pdf";
var Path = this.path;
var AcDate = new Date();
var AcDateFormat = "yyyy/mmm/dd HH:MM"
var Box2Width = 50
for (var p = 0; p < this.numPages; p++)
{
var aRect = this.getPageBox("Crop",p);
var TotWidth = aRect[2] - aRect[0]
if (ARG<=3 || ARG==5)
{var fd = this.addField("xftDate", "text", p, [30,15, TotWidth-30-30,30]);
fd.value = util.printd(AcDateFormat, AcDate) + " (" + FileNM +")";
fd.textSize=6; fd.readonly = true;
if (ARG==1){ fd.alignment="left" };
if (ARG==2){ fd.alignment="center" };
if (ARG==3){ fd.alignment="right" };
}
if (ARG==4 || ARG==5)
{var bStart=(TotWidth/2)-(Box2Width/2)
var bEnd=((TotWidth/2)+(Box2Width/2))
var fp = this.addField(String("xftPage"+p+1), "text", p, [bStart,30,bEnd,15]);
fp.value = "Page: " + String(p+1)+ "/" + this.numPages;
fp.textSize=6; fp.readonly = true;
fp.alignment="center";
}
} }


function RemoveFooter(ARG)
{
if (ARG<=3 || ARG==5) {var x = this.removeField("xftDate");}
if (ARG==2 || ARG==5) {for (var p = 0; p < this.numPages; p++)
{
var x = this.removeField(String("xftPage"+p+1)); }
} }
Back to top
Jeffrey_Kuhn (A_T) adobeforums.com
Guest





PostPosted: Thu Nov 16, 2006 6:01 pm    Post subject: Re: Print File Name with pdf Document

Hi Reinhard,

Thanks for working on this. However, this script does not work, because the "Set/Remove Footer" submenu does not appear in my File menu (the previous version worked fine). I have carefully copied and pasted your script into a new .js file in the \javascripts folder. What could I be doing wrong?

Jeff
Back to top
Reinhard_Franke (A_T) adobeforums.com
Guest





PostPosted: Thu Nov 16, 2006 9:33 pm    Post subject: Re: Print File Name with pdf Document

I've edited above script and now it should work.

br, Reinhard
Back to top
Jeffrey_Kuhn (A_T) adobeforums.com
Guest





PostPosted: Thu Nov 16, 2006 11:09 pm    Post subject: Re: Print File Name with pdf Document

Thanks. Can you post it?

Regards

Jeff
Back to top
Reinhard_Franke (A_T) adobeforums.com
Guest





PostPosted: Fri Nov 17, 2006 8:34 am    Post subject: Re: Print File Name with pdf Document

I think there is no need. I copied it out and in and it works fine for me (AAr5).

However you may state where to sent to and you will get it.

br, Reinhard
Back to top
Reinhard_Franke (A_T) adobeforums.com
Guest





PostPosted: Fri Nov 17, 2006 8:20 pm    Post subject: Re: Print File Name with pdf Document

Just remembered to some Webspace I have. You can download from:

<http://www.Refob.de/downloads/acrobat/SetRemoveFooter.js>

HTH Reinhard
Back to top
Jeffrey_Kuhn (A_T) adobeforums.com
Guest





PostPosted: Fri Nov 17, 2006 8:30 pm    Post subject: Re: Print File Name with pdf Document

Hello Reinhard,

The script you modified on 16 Nov does not appear in the forum posting, so I cannot copy and paste it. However, if you can email it to me at jeff (AT) hilspen (DOT) net I would very much appreciate it.

Thanks and regards,

Jeff
Back to top
   Adobe Acrobat Reader (For Windows) Forum Index -> Adobe Acrobat Reader (For Windows)All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

Related Topics