Skip navigation

Print File Name with pdf Document

Aug 30, 2006 10:52 AM

  Latest reply: saintjohnny, Jan 9, 2014 11:59 AM
Replies 1 2 3 4 Previous Next
  • Currently Being Moderated
    Nov 24, 2011 5:32 AM   in reply to UenglishmanSA

    Hi,

     

    it seems you have an older version. In the latest you can choose if you only want to print Date and filename only.

    The latest version you can download from:

     

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

     

    If you have the old version I assume you can delete or comment out (= write // in the front of the text) this lines:

    var fp = this.addField(String("page"+p+1), "text", p, [330,10,280,28]);     //<- this set up the page number file

    fp.textSize=8; fp.value = "Page: " + String(p+1)+ "/" + this.numPages;  //<- this fomat the page number field

     

    If that not help, please copy in the js-code you work with, so also other with a more compareable working time, can give you the small changes.

     

    best regards, Reinhard

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 27, 2011 12:22 PM   in reply to ReinhardF

    Hi ReinhardF!

     

    I would like to have a footer showing only this:

     

    The full file path + date

     

    What changes should I do in your original script which, however, works perfect in AA X.

     

    Regards

    Arne

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 28, 2011 11:37 AM   in reply to hilljensen

    Hi,

     

    you can change in the script following lines:

     

    var AcDateFormat = "yyyy/mmm/dd  HH:MM"

    to

    var AcDateFormat = "yyyy/mmm/dd"

     

    and

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

    to

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

     

    best regards, Reinhard

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 28, 2011 11:10 PM   in reply to ReinhardF

    Thanks, I have allready changed those two lines.

     

    But I would also get rid of all lines that is about page numbers, because I will not use that.

     

    How to change the line : fd.value = util.printd .........................

    to show the full path first an then the date?

     

    Thanks in advance!

     

    Best regards

    Arne

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 29, 2011 4:39 AM   in reply to hilljensen

    Change to:

    fd.value =  "Path: " + Path +"  Date: " + util.printd(AcDateFormat, AcDate);

    or similar, where "..." is "my Text".

     

    HTH, Reinhard

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 29, 2011 7:50 AM   in reply to ReinhardF

    Reinhard,

     

    Dies ist eine sehr gute Arbeit!

     

    I have read this thread with interest since I nioticed it today and have placed your JavaScript in my Acrobat 6.0 install folder. I have been able to make modifications to the components of the footer (date format, adding PRELIMINARY to the textstring, changing text size). It works very well and gives me a new tool for identifying preliminary versions of manuals.

     

    Would you explain how to change the location of the footer? I would like to place it a little higher on the page. 

     

    BTW, I noticed that Acrobat has a feature called Add Headers & Footers but it is much more time consuming to use and does not have the flexibility, ease of use, and performance of your script.

     

    Danke,

     

    Michael F

    =======

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 29, 2011 9:00 AM   in reply to Michael314

    Danke Michael,

     

    habe einfach nicht die Zeit es mal komplett - mit mehr Optionen - zu überarbeiten.

     

    "Would you explain how to change the location of the footer? I would like to place it a little higher on the page."

     

    You can inrease the y-coordinates: upper left (y1) and lower right (y2):

     

    If you want the field 10 Pts higher you can change:

    var fd = this.addField("xftDate", "text", p, [30,15, TotWidth-30-30,30]);

    to

    var fd = this.addField("xftDate", "text", p, [30,15+10, TotWidth-30-30,30+10]);

     

    The difference between y1 and y2 is the field hight.

    The calculation for the field placing on the page start at lower left corner (= 0).

     

    HTH, Reinhard

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 30, 2011 1:00 AM   in reply to ReinhardF

    This goes both to ReinhardF and Michael314!

     

    I'm a total novise as far as programming is concerned. I have ReinhardF's javascript and it works perfect i AA X.

     

    I wonder if some of you experts could make me a Javascript that show the full file path and nothing else on the first page only of a document as a footer.

    Please give me the option of choosing between left, center or right position.

     

    Thanks!!!!

     

    Best regards

    Arne

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 30, 2011 9:02 AM   in reply to hilljensen

    Arne,

     

    Reinhard did give you a hint back in post 124.

     

    Change the fd.value statement to this:

     

    fd.value =  "Path: " + Path;

     

    When you open the PDF file and select any of the Set Date... commands, it will insert only the file path.

     

    I think the pages affected are controlled by this statement but I don't know how to adjust it.

     

    for (var p = 0; p < this.numPages; p++)

     

    Yours,

     

    Michael F

    =======

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 2:22 AM   in reply to Michael314

    "I think the pages ..." thats correct.

     

    @ Arne

    Change:

    for (var p = 0; p < this.numPages; p++)

    to

    for (var p = 0; p < 1; p++)

    to get it only on the first page, or:

    for (var p = 1; p < this.numPages; p++)

    to get it on all, but not on first.

     

    The second question: "Please give me the option of choosing between left, center or right position" astonished me. It's already in the menu selection. I think at least you can test the script before asking.

     

    best regards, Reinhard

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 3:38 AM   in reply to ReinhardF

    Hello ReinhardF

     

    great script, just does what I expected. One Question

     

    Line:

    & "fd.textSize=6;   "&vbLF _

     

    I changed Textsize to 10 and it works fine, but is there a possibility to get the textstyle bold? I tried:

    & "fd.textStyle=bold;   "&vbLF _

     

    but didn't work. I don't to the Scripting Parameters so I ask in this Forum.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 4:43 AM   in reply to ReinhardF

    Hi!

     

    Sorry about that second question, it is already solved.

     

    The last thing I 'll ask is what lines to be removed when I don't need the page numbering.

     

    Thanks for the great effort!

     

    Best regards

    Arne

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 4:51 AM   in reply to Ma-ik

    Hi,

     

    there exists no property "textStyle". You have to choose a font in bold. So font:

    font.TimesB, font.HelvB, font.CourB

     

     

    

    ###can be used. If you add a I at the end it will be bold+Italic.

     

    So you can Write (in above VBS file):

    &"  fd.textSize=10; fd.textFont = font.TimesB;  "&vbLF_

    

    Pay attention to the point that JS is case sensitive.

    Load down the AcroJs.pdf helpfile and have a look at the Field Object -> Field properties.

    So you may use textColor or fieldBorder or ...

    

    Good luck, Reinhard

    

    PS: That just gives me the idea to change the VBS-files so that the js-variable will be set by reading saved poor JS-Code.

    That avoid the change to vbs-writing (&"         "&vbLF), the js-code could directly tested in the acrobat-js-console and all saved versions could be executed by selecting the file. I think I will put it on my list.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 6:49 AM   in reply to ReinhardF

    Reinhard,

     

    To give users some variety, they can also use non-bold fonts, so brief font list looks like this:

     

    fd.textFont = fontname;

     

    where fontname can be:

     

    font.Times

    font.TimesB

    font.Helv

    Font.HelvB

    font.Cour

    font.CourB

     

    We're taqlking about text in a footer, so you should not need more variety than this.

     

    Yours,

     

    Michael F

    ========

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 8:08 AM   in reply to Michael314

    "...... so you should not need more variety than this."

     

    They have it already. You forgot the italic fonts - lol. :-)

    
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 11:35 AM   in reply to hilljensen

    @Arne

     

    simple delete or comment out (like as follow) these lines:

     

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

     

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

     

     

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

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

     

    The statement cName:"..xxx.." is only the menu item display name. So you change it for rest to whatever you want-

     

    Good luck, Reinhard  

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 1, 2011 3:30 PM   in reply to ReinhardF

    @Reinhard

     

    Thank you very much for your useful script and your helpful replies to users questions here.  This will streamline my workflow 100x

     

    I've taken the script in AA X and modified page position to fit specific documents.

     

    As a quick guide to help others, initially I didn't have a good grasp on the placement syntax and would like to share with others here what I "figured out".

     

    [10,30,545,40]

     

    10 = Places the start of the text box 10 pixels from the left most edge (x1 coordinate) of the document

    30 = Places the bottom of the text box 30 pixels from the bottom (y1 in your post) edge of the document

    545 = Places the end of the text box 545 pixels from the left most edge (x2 coordinate) of the document (ie. 535 pixel wide text box, starting 10 pixels from left most edge)

    40= Places the top of the text box 40 pixels from the bottom edge (y2 in your post) of the document (ie. 10 pixel high text box)

     

    Is this logic correct?

     

    Also, I plan to share this with other collegues in my office, I would like to put the following header in the script, with your permission.  If you would like me to add any other credit text, please post it or send via PM

     

    //Original script written by ReinhardF, Nov 13, 2006

    //For specific questions, visit http://forums.adobe.com/thread/302996?tstart=0

     

    Thanks again!

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 2, 2011 6:57 AM   in reply to ReinhardF

    Is there a way to rotate the text 90 degrees?

     

    I have documents that have text at the top most and bottom most part of the page, but an inch of whitespace on the right hand side.

     

    What I'm hoping to do is have text run along the right-hand side and when the page is in a 3-ring binder, the text is running LR reading order starting in the lower right corner, running up to the top right side of the page.

     

    Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 2, 2011 12:55 PM   in reply to harringg_

    Hi,

     

    "Is this logic correct?" -> Yes it is.

    "Also, I plan to share" -> No problem.

    "Is there a way to rotate the text 90 degrees?" No problem : fd.rotation=90

         found at; AcroJs.pdf Field object -> Field property =>rotation

    "have text run along the right-hand side " Not realy a porblem, you need: var TotHeight = aRect[1] - aRect[3];

          found at; AcroJs.pdf Doc object ->  Doc methods  = > getPageBox

     

    With that you have all information to set it als header, in the middle or wherever you want.

     

    Good luck, Reinhard

     

     

     

     

     

    
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 7, 2011 12:18 AM   in reply to ReinhardF

    Hi ReinhardF!

     

    I have tried to modify the script to meet my needs, that is ONLY the filepath to be shown on the first page only, no need for page number or date.

     

    My script looks like this:

     

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

     

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

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

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

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

     

    function SetFooter(ARG)

    {

    var re = /.*\ / | \ .pdf$/ig;

    var Path = this.path;

    var Box2Width = 50

    for (var p = 0; p < 1; p++)

      {

        var aRect = this.getPageBox("Crop", p);

        var TotWidth = aRect[2] - aRect[0]

        if (ARG<=3 | | 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.alignement="left"  };

               if (ARG==2){ fd.alignement="center"  };

               if (ARG==3){ fd.alignement="right"  };

         }

       if  (ARG==4 | |  Arg==5  | | ARG==9)

        {  var bStart=(TotWidth/2)-(Box2Width/2)

             var bEnd=((TotWidth/2+8Box2Width/2))

             if (ARG==5){var bStart=8TotWidth-Box2Width-30); var bEnd=(TotWidth-30);}

             var fp = this.addField(String("xftPage"+p+1),  "text" , p, [bStart, 30, bEnd, 15]);

        }

      }

    }

    Function RemoveFooter(ARG)

    {

    if  (ARG<=3 | | ARG===9)  {var x = this.removeField("xftDate");}

    }

     

    Is ther anything more I can remove from this script, and still make it to work for the file path only?

    Just to reduse the script to a minimum.

     

    Thanks from Arne!

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 7, 2011 1:09 PM   in reply to hilljensen

    "Is ther anything more I can remove from this script"

     

    Sure, take this:

     

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

     

    app.addMenuItem({cName: "Left", cParent: "Footer", cExec: "SetFooter(1)"});
    app.addMenuItem({cName: "Center", cParent: "Footer", cExec: "SetFooter(2)"});
    app.addMenuItem({cName: "Right", cParent: "Footer" , cExec: "SetFooter(3)"});
    app.addMenuItem({cName: "Remove", cParent: "Footer", cExec: "this.removeField('xftDate');"});

     

    function SetFooter(ARG)
    {
    var Path = this.path;
    var Box2Width = 50;
    var page = 0;
    var aRect = this.getPageBox("Crop", page);
    var TotWidth = aRect[2] - aRect[0];

    var fd = this.addField("xftDate",  "text" , page, [30, 15,  TotWidth-30-30, 30]);
    fd.value = Path;
    fd.textSize = 6;
    fd.readonly = true;
    if (ARG==1){fd.alignement="left"};
    if (ARG==2){fd.alignement="center"};
    if (ARG==3){fd.alignement="right"};
    }

    

     

    best regards, Reinhard

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 8, 2011 12:17 AM   in reply to ReinhardF

    Thanks ReinhardF!!!

     

    This is more than perfect!

     

    By the way, do you know why this does not work with Reader?

     

    Best regards from Arne.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 8, 2011 4:09 AM   in reply to hilljensen

    Reader don't can add fields - only fill existing.

    Only with Reader you can use a freeware tool like BeCyPdfAsm (http://www.becyhome.de/news_eng.htm) to set a footer.

     

    best regards, Reinhard

    
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 8, 2011 4:22 AM   in reply to ReinhardF

    Reader can add fields, if the right to do so has been applied to the file

    in Acrobat.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 8, 2011 4:37 AM   in reply to Gilad D (try67)

    Hi try67!

     

    How do you do this?

     

    Regards

    Arne

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 8, 2011 4:45 AM   in reply to hilljensen

    In Acrobat? Depends on your version. In Acrobat X it's under File - Save As

    - Reader Extended PDF - Enable Additional Features...

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 8, 2011 11:21 PM   in reply to Gilad D (try67)

    Hi,

     

    I have tested this procedure, and it works with AA X.

     

    But you need to have AA X, it can't be done in Reader. That means you have to save it in AA X and then open the file in Reader and then run the function.

     

    Most people have only Reader and then it can't be done.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 8, 2011 11:37 PM   in reply to ReinhardF

    Hi Reinhard!

     

    Can you please test the shortened script from answer 140? It allways place the file path to the left even if I press menu item "Center" or "Right".

     

    Regards Arne

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2011 3:11 AM   in reply to hilljensen

    You may use

     

       if (ARG==2){fd.alignment="center"};

     

    not

     

       if (ARG==2){fd.alignement="center"};

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2011 4:17 AM   in reply to Bernd Alheit

    Thanks, Bernd!!

     

    A mis-spelling can cause unexpected errors.

     

    Best regards from Arne

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 12, 2012 12:54 PM   in reply to ReinhardF

    Mr. Reinhardf Im using your script and I will like to change the code a little bit in order to get just some parts of the path,

     

    Ex. my actual path is something like /1/2/3/4/5/abc.pdf and will like to change the footer to something like 4/5/abc.

     

    1/2/3 will be always the same part of the path; all documents are in the same drive.

     

    I know I need to change this part of you code

     

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

     

    But I can’t get what I want.

     

    Any help will be appreciated

     

     

    
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 8, 2012 4:02 PM   in reply to ReinhardF

    Is it possible to print the the specific bookmark title/page title of each page in the footer of the pdf? 

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 25, 2013 8:40 PM   in reply to interstate 8

    Another method, but not using Java Script, and this method may applied to each single file only.

    http://www.uwec.edu/help/Acrobat9/for-date.htm

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2013 8:46 AM   in reply to EGStatus

    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[i].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.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2013 10:23 PM   in reply to ReinhardF

    Hi ReinhardF!

     

    In Acrobat 9 Pro Batch, execute JavaScript, please provide a script to add the footer and displays the date and file name,
    Thank you very much!

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 9, 2014 11:59 AM   in reply to (Lloyd_G_Guenther)

    For googlers who find this thread down the road:

     

    I posted this on another forum here but I wanted to spread the wealth:I too wanted to be able to batch process the stamping of PDF filenames on the footer of many PDF files and could not find a good solution that was consistent through different versions of adobe.  I saw .NET sourcecode on another site, but it did not batch process, so converted it to do so.  I'm no great with visual basic however it does the trick:

     

    Executabe (needs DLL in same directory as executable): http://saintjohnny.dyndns.biz/pdfFooterMarker%20(unzip%20and%20keep%20 DLL%20in%20same%20folder%20as%20executable).zip

     

     

    Sourcecode: if you want it: http://saintjohnny.dyndns.biz/PDF%20Footer%20Source.zip

     

    I've also added so that you can also stamp prefix/suffix before and after the filename, as well as stamp custom text ignoring filenames, and change the height of the stamp to go on the top of the page as a header if needed.  Since this isn't a true footer/header, it retains the information when combining PDFs later on which is a plus.  Also this method doesn't add the .PDF at the end of the filename stamp.

     
    |
    Mark as:
1 2 3 4 Previous Next
Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)