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
    Jun 6, 2008 8:32 AM   in reply to (Lloyd_G_Guenther)
    How can I just add a footer to odd or even pages only? Here is my code below!

    app.addMenuItem({cName:"Training Guide - Insert Footer", cParent:"Document", nPos:3, cExec:"PrtFooter();"});


    function PrtFooter()
    {
    var re = /.*\/|\.pdf$/ig;
    var FileNM = this.path.replace(re,"")+"";
    for (var p = 3; p < this.numPages; p++)
    {
    var fd = this.addField("Date", "text", p, [520,45, 670,5]);
    fd.textSize=9; fd.readonly=true; fd.value = "" + util.printd("mm/dd/yyyy", new Date())
    var fd = this.addField("File", "text", p, [43,45, 250,5]);
    fd.textSize=9; fd.readonly=true; fd.value = "" + util.printd("", new Date()) + FileNM
    var fp = this.addField(String("page"+p+1), "text", p, [280,45,335,5]);
    fp.textSize=9; fp.readonly=true; fp.value = "Page " + String(p+1)+ " of " + this.numPages;
    }
    }
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 8, 2008 2:06 PM   in reply to (Lloyd_G_Guenther)
    Write:

    var p=p+1

    at the end of the for loop.

    HTH, Reinhard
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2008 1:26 PM   in reply to (Lloyd_G_Guenther)
    Hi !!

    I'll ask to help me.
    I search a solution to print a document pdf.
    I want to print a pdf's file and close acrobat reader.

    Witch the command line, I can open file and print the file. But I can't close the api acrobat reader.

    Anyone could say me if there are a solution. Witch a command line or a javascript program or other.

    Thanks to your help
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2008 8:05 AM   in reply to (Lloyd_G_Guenther)
    I'm having the same problem with the "internal error" message. I am using Reader 8 and have saved the "txt" file created in Notepad to "program files->adobe->Redaer 8.0->Reader->Javascripts". I am using Windows XP.
    The Set/Remove Footer option is showing in the "File Menu" in Reader 8.0. However, the internal error occurs whenever i try to click on it.
    Any help would definitely be appreciated.
    Thanks!
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2008 8:12 AM   in reply to (Lloyd_G_Guenther)
    You can use this JavaScript code only with Adobe Acrobat, not Adobe Reader.
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2008 9:21 AM   in reply to (Lloyd_G_Guenther)
    Thanks for the quick response! Do you happen to know if there is anyway to provide the footer info in Adobe Reader?
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2008 9:51 AM   in reply to (Lloyd_G_Guenther)
    You might also ask in the Reader forum, since it is a different product

    http://www.adobeforums.com/webx?13@@.3bbf42f7
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2008 10:06 AM   in reply to (Lloyd_G_Guenther)
    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.
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2008 2:12 PM   in reply to (Lloyd_G_Guenther)
    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
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2008 2:17 PM   in reply to (Lloyd_G_Guenther)
    Oh,
    took the german link
    here the english one.

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

    Best regards, Reinhard
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 1, 2008 10:31 AM   in reply to (Lloyd_G_Guenther)
    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?
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 12, 2008 1:18 PM   in reply to (Lloyd_G_Guenther)
    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
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2008 12:33 AM   in reply to (Lloyd_G_Guenther)
    You can use the function SetFooter in a batch sequence.
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2008 2:54 AM   in reply to (Lloyd_G_Guenther)
    addWatermarkFromText will also do the trick.
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 14, 2008 12:20 AM   in reply to (Lloyd_G_Guenther)
    You need to put some script to fetch the header.I will try to find one script for you
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2008 10:02 AM   in reply to (Lloyd_G_Guenther)
    Can anyone tell me which line in this javascript is the one that positions the text?
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 22, 2008 4:35 AM   in reply to (Lloyd_G_Guenther)
    In all lines with .addField in [....].

    HTH, Reinhard
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 22, 2008 5:59 AM   in reply to (Lloyd_G_Guenther)
    The addField uses points to position the field on the page.
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 24, 2008 6:43 AM   in reply to (Lloyd_G_Guenther)
    Will this script run in version 9 for the Mac? i've depended on this script in version 8 for Windows, but I've just moved to the Mac and can't get it to run. Where should the .js file be located in a Mac so that it's available to all uses of the computer?

    Many thanks
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 24, 2008 10:42 AM   in reply to (Lloyd_G_Guenther)
    Thank you for your assistance. I was wondering if there was anyway to update this script so that it would make a header instead of a footer.
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 24, 2008 10:54 AM   in reply to (Lloyd_G_Guenther)
    RHarris - Boy oh boy, you are really giving Reinhard a run for his money.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2008 12:43 PM   in reply to (Lloyd_G_Guenther)
    I have been trying to find information for this and it seems like a tough one. I have 4000 pdf's that need to be printed with the filename in the header or footer.

    I have tried using a script Reinhold posted a couple of years back and it works quite well, but only one file at a time. Can anyone help me on this?

    Thanks! Will
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2008 1:56 AM   in reply to (Lloyd_G_Guenther)
    You can use the functions in a batch sequence.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2008 9:59 AM   in reply to (Lloyd_G_Guenther)
    If this forum is still active, I am looking for help. I've tried all the above scripts and none of them modify the menue in Acrobat Standard 8.

    I've saved them with a .js extension in the javascript folder for AS8.

    Any help would be appreciated.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2008 12:15 PM   in reply to (Lloyd_G_Guenther)
    Mmmh,

    if you have copied the download version (Post #13) into the correct folder (...\javascript} you should at least:
    - get an error message or
    - see at least the menuitems "Set/Remove Footer" under the main menuitem "File".

    Some other who have used it under AS8?
    My version is still AA5.

    Best regards, Reinhard
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2008 12:39 PM   in reply to (Lloyd_G_Guenther)
    It works with Acrobat 8.1.1 Professional on Windows XP.

    After you save this script in the appropriate folder, you need to exit and restart Acrobat for it to take affect. And you should then see the new option under the 'File' menu option.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2008 12:48 PM   in reply to (Lloyd_G_Guenther)
    Reinhard's script DID work in Acrobat 8 Standard.

    My post the other day has been resolved! I used Acrobat 9 Pro and did a batch process. I added a step in a new batch using "Add Printer Marks" and selected the "Page Information" box.

    I kept looking for this option but it seems it is only available in the Professional version, NOT the Standard version!!

    Thank You all for your help! Will
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2008 12:58 PM   in reply to (Lloyd_G_Guenther)
    Batch processing is only available in the Professional or Extended veriations.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2008 1:03 PM   in reply to (Lloyd_G_Guenther)
    thank you all for the replies and what has been a tremendous effort on this thread.

    I have tried each of the scripts several times, each time exiting the program and relaunching. Still no change in the menu selections. I assume it's not any kind of administrative permissions issue?

    I've checked the preferences and 'enable javascript' is selected. The files have been saved with the .js extension and their icon indicates that they are scripts.

    I am running v. 8.1.3. any other thoughts? Thanks.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2008 1:25 PM   in reply to (Lloyd_G_Guenther)
    Where did you save the script?
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 5:43 AM   in reply to (Lloyd_G_Guenther)
    Does anyone know where we could change the COLOR of all the text and specific words? I want to add a FINAL PRINT COPY, instead of the word Page. Also, we want the text to be GREEN instead of default black.

    KPANTHEN, Albany, NY
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 6:24 AM   in reply to (Lloyd_G_Guenther)
    > Does anyone know where we could change the COLOR of all the text and specific words?

    Change the original document and create a new PDF document.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 6:49 AM   in reply to (Lloyd_G_Guenther)
    Bernd,

    I didn't mean the actual copy of the PDF file, I was referring to the JavaScript Header/Footer output.

    I would be very helpful if we could modify the word "Page" when referring to the Page #/#. We would want the words "FINAL PRINT COPY" #/#. Also the date could be in GREEN also.

    KPanthen, New York
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 6:58 AM   in reply to (Lloyd_G_Guenther)
    You can change the text in the JavaScript code. You can change also the color of the form fields. Details in the Acrobat JavaScript Reference.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 8:11 AM   in reply to (Lloyd_G_Guenther)
    I have been looking and really can't decifer where it should go. Can anyone help in the actual placement of the coding?

    KPanthen, New York
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 8:50 AM   in reply to (Lloyd_G_Guenther)
    If you are using version 6 or above, try the following script in the JavaScript Debugging console or add to a form button action:

    var sJSFolder = "JavaScript folders for " + app.viewerType + " are:";
    try {
    sJSFolder += "\nApplicaiton JavaScript folder; " + app.getPath("app","javascript");
    sJSFolder += "\nUser JavaScirpt folder; " + app.getPath("user","javascript");
    } catch(e) {
    sJSFolder += "User has not defined any application JavaScripts";
    }
    console.show();
    console.println(sJSFolder);

    You can then chose where to put the script.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 8:57 AM   in reply to (Lloyd_G_Guenther)
    @KPanthen

    Codeline:
    fp.value = "Page: " + String(p+1)+ "/" + this.numPages;
    replace with:
    fp.value = "FINAL PRINT COPY " + String(p+1)+ "/" + this.numPages;

    Codeline:
    fp.textSize=6; fp.readonly = true;
    replace with:
    fp.textSize=6; fp.readonly = true;fp.textColor = color.green;

    Maybe you set the fp.textSize=6 to 8 or 10, then you see the color better.

    I didn't test if the box is width enough for that.
    If not come back.

    Best regards, Reinhard
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 11:40 AM   in reply to (Lloyd_G_Guenther)
    Bernd,

    We had some network problems in our office and I had to restart my computer; the scripts now appear correctly, though I am not sure why(the script to add a comment field however gives me an error that I am missing a ';' in line 18).

    I applaud everybody's input and thank you once again.

    I have a couple question

    Is there a way to get a script that will add these items as a print watermark rather than to the file itself? Then if the file path changes the printed path would always be correct.

    Is there a way to incorporate the 'Appearance Option' that specifies to 'Shrink document to avoid overwriting'?

    Thanks.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 12:11 PM   in reply to (Lloyd_G_Guenther)
    You could use the doc "addWatermarkFromText()" method.

    For example:

    function PrtFooter() {
    var sFirstLine = "Date: " + util.printd("yyyy/mmm/dd", new Date()) + " (" + this.path +")\r"; // first line
    var sSecondLine; // second line
    for(p = 0; p < this.numPages; p++) {

    sSecondLine = "Page: " + String(p+1)+ "/" + this.numPages; // second line
    this.addWatermarkFromText({
    cText: sFirstLine + sSecondLine,
    nFontSize: 8,
    aColor: color.green,
    nStart: p,
    nEnd: p,
    nTextAlign: app.constants.align.left,
    nHorizAlign: app.constants.align.left,
    nVertAlign: app.constants.align.bottom,
    bOnScreen: false,
    bOnPrint: true
    });

    } // end page loop
    // this.print();
    this.dirty = false; // cancel save prompt flag
    } // end PrtFooter function
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2008 1:03 PM   in reply to (Lloyd_G_Guenther)
    Geo,

    How does this work? How do I invoke the script?

    It doesn't appear to modify the menus or the print dialog box.

    Thanks.
     
    |
    Mark as:
Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)