Skip to main content
Participant
August 30, 2006
Question

Print File Name with pdf Document

  • August 30, 2006
  • 93 replies
  • 245470 views
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?
This topic has been closed for replies.

93 replies

try67
Community Expert
Community Expert
October 13, 2008
addWatermarkFromText will also do the trick.
Bernd Alheit
Community Expert
Community Expert
October 13, 2008
You can use the function SetFooter in a batch sequence.
Participant
October 12, 2008
First of all, thanks to everyone who contributed to the solution presented in the thread (particularly Reinhard Franke). But I was curious if there was anyway to use this script to batch process files in a given directory? Or... can someone point me in the proper direction to help me employ this type of functionality?
Thanks, Paul
Participant
July 1, 2008
The javascript that Reinhard Franke posted above is what i've been looking for, except that i don't want it show the date and time stamps, only the file path.

I tried editing Reinhard's script with no success (probably because i don't know java). Can anyone create a simplified version of this script just for adding/removing the file path. Or does anyone know of another script that will accomplish what i'm looking for?
ReinhardF
Participating Frequently
June 25, 2008
Oh,
took the german link
here the english one.

http://www.becyhome.de/download_eng.htm#becypdfasm

Best regards, Reinhard
Participant
November 1, 2010

Reinhard Franke,

How do I print the Bookmark name?

I have many pdf documents, where each bookmark is a page.

I am already using part of the script that print the page number. I would like to print each bookmark along with the page number.

I have modified the line

fp.value = "Page: " + String(p+1)+ "/" + this.numPages + " -- " + this.bookmark '// This does not print it.

My knoledge of java script is limited.

Can you please help?

Thanks

Participant
May 24, 2013

I have modified Java Script. This is to make footer as the bookmark name of each pages(only applies 1st level bookmarks). I use this script when I merge many files into one PDF.

Please see below:

=======================
app.addSubMenu({ cName: "BMKFooter",cUser: "BookMark Footer", cParent: "File", nPos: 21 });


app.addMenuItem({ cName: "Set", cParent: "BMKFooter", cExec: "SetFooter(9)"});


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


app.addMenuItem({ cName: "Remove", cParent: "BMKFooter", cExec: "RemoveFooter(9)"});


//Set/remove Footer
function SetFooter(ARG)
{
var bmk = this.bookmarkRoot;
var BMKName;
var lastBMKPage=0;
var currentBMKPage=0;
var p=0;

if(bmk.children != null){ 

for(var i = 0; i < bmk.children.length; i++){ 

BMKName=bmk.children.name;

if(i<=bmk.children.length-2){
bmk.children[i+1].execute();
lastBMKPage = this.pageNum-1; }
else {lastBMKPage = this.numPages -1;}

for ( p = currentBMKPage; p <= lastBMKPage; p++){

var aRect = this.getPageBox("Crop",p);
var TotWidth = aRect[2] - aRect[0]
if (ARG==9)
  {var  fd = this.addField(String("xftDate"+p+1), "text", p, [30+TotWidth/2,15, TotWidth-30,40]);
  fd.value = " " + BMKName +" "; //print bookmark name
  fd.textSize=10; fd.readonly = true;
  fd.alignment="right";
  }

currentBMKPage = lastBMKPage +1;

}}

function RemoveFooter(ARG)
{
if (ARG==9)
{for (var p = 0; p < this.numPages; p++)
{var x = this.removeField(String("xftDate"+p+1));}
}
//if (ARG==9)
//{ for (var p = 0; p < this.numPages; p++)
//{var x = this.removeField(String("xftPage"+p+1)); }
//if (ARG<=3 || ARG==9) {var x = this.removeField("xftRem");}
//}
}

==========================

This is very late response. But I hope this is helpful for you.

ReinhardF
Participating Frequently
June 25, 2008
If you have only the Reader you can use a freeware like this:

http://www.becyhome.de/download_ger.htm#becypdfasm

Not perfect, but it works and for batch processing (merge, split, bookmarks) much easyer to use as Acrobat.

HTH, Reinhard
Inspiring
June 25, 2008
One can use JavaScript in Reader, but JavaScript can only be added and edited in Acrobat. There are also many JavaScript methods that can not be done in Reader.

It is certainly possible to use Acrobat to add a field in the footer area, add a "Will Print" action to fill the form field with the file name to the field. Because the field already exist, there is no need to perform this action in Reader. And the "Will Print" insertion of the file name by JavaScript will work in Reader. In fact the Acrobat JavaScript includes information as to which JavaScript object, properties, and methods are available for use in Reader to help form developers know what can be done by an end user with Reader.

addWaterMarkFromFile is available to JavaScript in Acrobat but is not available to Reader when using JavaScript or not.

Of course the above assumes one has access to the Professional version of Acrobat and can edit the PDF.
John T Smith
Community Expert
Community Expert
June 25, 2008
You might also ask in the Reader forum, since it is a different product

http://www.adobeforums.com/webx?13@@.3bbf42f7
Participant
June 25, 2008
Thanks for the quick response! Do you happen to know if there is anyway to provide the footer info in Adobe Reader?
Bernd Alheit
Community Expert
Community Expert
June 25, 2008
You can use this JavaScript code only with Adobe Acrobat, not Adobe Reader.