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 5 4 Previous Next
  • 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.

    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++){ 


    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;

    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): DLL%20in%20same%20folder%20as%20executable).zip



    Sourcecode: if you want it:


    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 5 4 Previous Next

More Like This

  • Retrieving data ...

Bookmarked By (0)