• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
1

Print File Name with pdf Document

New Here ,
Aug 30, 2006 Aug 30, 2006

Copy link to clipboard

Copied

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?
TOPICS
Print and prepress

Views

237.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
replies 161 Replies 161
Engaged ,
Nov 17, 2006 Nov 17, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 17, 2006 Nov 17, 2006

Copy link to clipboard

Copied

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

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

HTH Reinhard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 17, 2006 Nov 17, 2006

Copy link to clipboard

Copied

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 **** I would very much appreciate it.

Thanks and regards,

Jeff

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 17, 2006 Nov 17, 2006

Copy link to clipboard

Copied

Jeffrey,

Click the "Show all messages" link towards the top of the thread and you'll see his post.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 09, 2007 Mar 09, 2007

Copy link to clipboard

Copied

Reinhard, I love this Javascript for printing the file name as a footer on Acrobat documents; however, I DO need the whole path name as well as the file name to print on my documents...how do I fix this script so that this will happen? Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 11, 2007 Mar 11, 2007

Copy link to clipboard

Copied

In the line:

fd.value = util.printd(AcDateFormat, AcDate) + " (" + FileNM +")";

replace FileNM with Path.

Best regards, Reinhard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 13, 2007 Mar 13, 2007

Copy link to clipboard

Copied

This is fantastic...just what I was look for!...I just need to add a line of text stating the document will expire after so many days and the date and time to be ...mm/dd/yyyy and standard time not military time. What do I need to add and/or change to achieve this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

1.)Dateformat
Change the line:
var AcDateFormat = "yyyy/mmm/dd HH:MM"
to your needs, like:
var AcDateFormat = "mm/dd/yyyy"

For more Date formats have a look at the JavaScript help file:
http://www.adobe.com/devnet/acrobat/pdfs/js_api_reference.pdf#page=716

2.)document will expire
A simple solution would be (see "answer #8"):
- 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.

Another solution would be to set up an extra field (box) for that.

HTH, Reinhard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

Reinhard,

I have altered your code a bit for my specific needs...I need the month/day/time, then document name on the left hand side of the footer, the page of pages in the center...which you have...but then also...on the right hand side of the page, I need it jus plain text where I can type in a message....the code that you've written is a fantastic start...I jus need to figure out how to get that last part in there..and im fairly new to all this...plus..I don't know if removing stuff, I've messed up the other code...seems functional when I test it, but it maybe a bit sloppy after me messing with it!...how do I add that last piece of code? Thanks for your help!!

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

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

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

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

//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 = "mm/dd/yyyy 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==9)
{ 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==9)
{ var bStart=(TotWidth/2)-(Box2Width/2)
var bEnd=((TotWidth/2)+(Box2Width/2))
if (ARG==5){var bStart=(TotWidth-Box2Width-30); var bEnd=(TotWidth-30);}
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==9) {var x = this.removeField("xftDate");}
if (ARG==9)
{ for (var p = 0; p < this.numPages; p++)
{var x = this.removeField(String("xftPage"+p+1)); }
}
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

Hi

I've been struggling to create an excel document which needs to go out with a header in the form of our company logo. As Excel has very limited layout capabilities, is it possible to use your script to add a header which just includes a (positioned) logo to an excel file being printed to PDF?

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

Fantastic with the JS.

Thanks to Reinhard and You all.

I'm a 100% novice in this.

But the

var re = /.*\/|\.pdf$/ig;
var FileNM = this.path.replace(re,"")+".pdf";
var Path = this.path;

doesn't seem to work by me. The filename is always "NaN.pdf".

However - after a look in the js api documentation, I changed the 3 lines to just

var FileNM =this.documentFileName

It seems to work. Am I missing something?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

@esma
You should open your own topic. It's a total different technic (watermarks or ..)

@allan
"Am I missing something?"
No. I use AAv5. "documentFilename" was introduced in later versions. Also the regular expression I used I took only because I just worked with that and was to lazy to look for "stringMid, stringInStr ..." in a JS-handbook.

Best regards, Reinhard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

@bjames

A quick solution.
Under: "if (ARG==3){ fd.alignment="right" };"
Insert:
var fr = this.addField("xftRem", "text", p, [30+TotWidth/2,15, TotWidth-30,30]);

fr.textSize=6;fr.alignment="right";


If you choose "Set Both" an extra field will be added to the right side of every page. This you can edit on one page for every page.

If you want to remove it via Menuitem, then
Under: "if (ARG<=3 || ARG==9) {var x = this.removeField("xftDate");}"
Insert:
if (ARG<=3 || ARG==9) {var x = this.removeField("xftRem");}

HTH, Reinhard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2010 Apr 21, 2010

Copy link to clipboard

Copied

This solution works for me too, filename and text on the right.

I'd like to shorten the text box from 1/2 page width to only 10-20 characters so the display is not cluttered. Can someone tell me how to reduce the size of the text box?

Here is the code that has been taken from these posts and modified for my personal use (filename and text ONLY for those of you that want to bypass modifying it on your own):

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

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

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

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

//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 = "dd-mmm-yyyy"
var Box2Width = 15
for (var p = 0; p < this.numPages; p++)
{
var aRect = this.getPageBox("Crop",p);
var TotWidth = aRect[2] - aRect[0]
if (ARG==9)
{ var fd = this.addField("xftDate", "text", p, [30,15, TotWidth-30-30,30]);
fd.value = " " + Path +" ";
fd.textSize=6; fd.readonly = true;
if (ARG==1){ fd.alignment="left" };
if (ARG==2){ fd.alignment="center" };
if (ARG==3){ fd.alignment="right" };
var fr = this.addField("xftRem", "text", p, [30+TotWidth/2,15, TotWidth-30,30]);

fr.textSize=6; fr.alignment="right"; fr.value = "Confidential"; 
}
if (ARG==9)
{ var bStart=(TotWidth/2)-(Box2Width/2)
var bEnd=((TotWidth/2)+(Box2Width/2))
if (ARG==5){var bStart=(TotWidth-Box2Width-30); var bEnd=(TotWidth-10);}
var fp = this.addField(String("xftPage"+p+1), "text", p, [bStart,30,bEnd,15]);
fp.value = "";
fp.textSize=6; fp.readonly = true;
fp.alignment="center";
}
}
}

function RemoveFooter(ARG)
{
if (ARG==9) {var x = this.removeField("xftDate");}
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");}
}
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 30, 2010 Aug 30, 2010

Copy link to clipboard

Copied

Great Topic

Using Adobe Pro9.0

I batch process the footer area of my PFD's but then after production I require a scrip that would:

Header Right

Produce the original print/ creation date and then update it with the print date others of whom may access the file (format 18AUG2010 or 18-AUG-2010)

AND

Also, I was hoping to capture the whom "the ID (author) of the person of whom had printed the record"

Sample Output

Tom Brady 18AUG2010

AND

Header Left

"Reference Only Copy"

Some of the code above appears to be applicable but I am not in a position to decipher a solution without guidance

Assistance is greatly appreciated

Lastly, does PDF security prevent the java?

Well Wishes

D

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 04, 2010 Sep 04, 2010

Copy link to clipboard

Copied


Dear experts Adobe Acrobat!


At me Adobe Acrobat Pro 9.3.4. At the print of file PDF by means of the printer "Adobe PDF" bookmarks from a outfile disappear. All options of the printer forbid to delete bookmarks, but it does not work! Can be exists JavaScript for this problem?


Yours faithfully, Katkovskij E.A.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2010 Sep 04, 2010

Copy link to clipboard

Copied

Don't know what you mean by all options forbid the deletions of bookmarks. Bookmarks have never been included in the printer, but have been part of PDF Maker that is a plugin developed primarily for MS OFFICE. To include bookmarks and such from other applications and have them show up when printing to the printer, you have to add PDF Marks to your document. That is typically done by adding small EPS files into the document. In fact, this was the way slide transitions were embedded with AA3. PDF Maker adds the PDF Marks as a preprocessing step before using the Adobe PDF printer, at least prior to AA9. The process in AA9 is different and am not sure of the steps Adobe took there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 05, 2010 Sep 05, 2010

Copy link to clipboard

Copied

Printing to the "Adobe PDF" printer is exactly like writing to a printer that creates a printed paper document, except the output is to a file and not paper. One loses all interactive features of the PDF. You can also print to paper and then scan an OCR the printed paper and have the same result, bu the PDF maybe of a better quality.

The "Adobe PDF" is a print driver that mimics a paper printer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 08, 2010 Nov 08, 2010

Copy link to clipboard

Copied

I wonder if this script will be working in Adobe Reader  9.X

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 08, 2010 Nov 08, 2010

Copy link to clipboard

Copied

Reader can not add form fields or watermarks, but you could add a text box annotation.

Reader will need to print "Markups and Document" or the annotation will not print.

The easiest way to do this is add a form form field using Acrobat and then have a script that fills in the value of the form field. This will work with Reader no matter how the print is setup.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2007 Mar 15, 2007

Copy link to clipboard

Copied

Reinhard,

Thank you so much for your help. I just have one question. You have the code written above so that you may type the footnote or message on the bottom of the page in acrobat. I would like to put the text or message in the JavaScript. That way when you SETBOTH, it adds everything to the bottom and that's it. So my question is, how do I put that information in the code? and secondly where? Thanks again for your help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 16, 2007 Mar 16, 2007

Copy link to clipboard

Copied

Add:
fr.value = "My Text";

to:
fr.textSize=6; fr.alignment="right";

e.g
fr.textSize=6; fr.alignment="right"; fr.value = "My Text";

HTH, Reinhard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 16, 2007 Apr 16, 2007

Copy link to clipboard

Copied

I got the "Set/Remove Footer" thing to show up above print setup under the file drop-down, but when I click on any of the options it says, "an internal error occurred"

Is this because I have Vista? any advice?

thanks for your help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 16, 2007 Apr 16, 2007

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 17, 2007 Apr 17, 2007

Copy link to clipboard

Copied

"Is this because I have Vista? any advice?"

I don't know. Which Acrobat version?
You may test the pure script (without app.addMeuitem) in the JS-Console.

best regards, Reinhard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines