Document Level Header Scripts

Hello -
I am looking for any assistance you may have.  I am working on a project in Acrobat Professional 7.0 that requires me to add the computer username to the header of a pdf file.  I have determined, and implemented this in Excel files using an onopen event.  I need to do the same thing but in a pdf file.  I have absolutely no javascripting experience so the more basic your explanation the better.
After reading up on the internet, I believe that I need a document level script?  I found an example that is:
this.addwatermarkfromtext({
ctext: "Confidential Document",
ntextalign: 2,
nhorizalign: 2,
nvertalign: 0,
nhorizvalue: -72,
nvertvalue: -72,
I entered that under Advanced, Javascript, Document Javascript but I receive an error that says typeerror: this.addwatermarkfromtext is not a function.  Again, I would need to change it to pull the username (I am assuming I can do this with a variable?).  I appreciate any and all help.
Thanks in advance for your time.

Thanks for the quick response.  Here is my situation.  The pdf file contains highly confidential information.  I want to email it out and have the username automatically appear in the header or footer so everyone is aware of who printed the copy.
If, according to your last post, cannot assign that to the document level then must that be applied on everyone's computer?  Please note that I am the only one with Professional.  All users will be using the Reader only.
Thanks again for all of your assistance.  It is greatly appreciated.

Similar Messages

  • How to print material document in header level?

    Hi Guys,
    How to print material document from header level. I can only print them in item level. But i want that in header level. For example, I have 4 movements inside a material document and I want to issue only one output from the header level.
    I can see the option Goto -> Additional Function -> output, but it is disabled. Please let me know hot to acheive this and if you need further info on this. Please throw some light on this.
    Thanks
    Yasin.

    HIi
      Your question is not clear.  What exactly you want to be.
    1.  To print material header in your smart form / Sap Script what is the problem. Itu2019s quite easy you can do it. Let me know what problem you are facing.
    2. The option is disables because of business functionality ask your functional guys to help you on the same.
    Regards
    Swati

  • Delete Document Level Script Using JavaScript?

    Hello all.
    Is there a way for a document level script to delete itself? I am running Adobe Acrobat Professional 11.
    My situation is that I am currently analysing data using a Java application. The Java application taylors a script to suit each specific PDF, and then inserts it into the PDF automatically. When the PDF is opened, the script runs once and then is no longer needed.
    As the script is no longer needed it would be preferred if the script could automatically be deleted. Is it possible the script has access to the field in which it is stored (e.g. doc.javascriptField = "";)? Or by some miracle, a delete function already exists?
    I think that due to the lack of need for such a function by general and advanced users I won't get the answer I am hoping for. But it is worth a shot. In the mean time, I am inserting a flag into the KeyWord field so that the script does not run twice. It works, but it is not exactly clean.
    Any help would be greatly appreciated.
    Thanks
    Jonny O

    My original idea of...
    stamper.addJavaScript("this.addScript("oneTimeScript", "app.alert('Annoying Popup')")");
    Did not work.
    However, while debugging I did come across the name given to a script added via iText (Java library). The default is "000000000000000". With any added scripts being incremented by 1. So the this.removeScript("ScriptName") function works perfectly.
    Thanks
    Jonny O

  • Document level scripting from process workflow

    Hi all,
    is there some way to add a "document level" script from process workflow in Livecycle Workbench?
    That is, I have a script i want to add to a pdf in my process workflow. How can I do that? Is there some service/function/script I can use to do that?
    I'd really appreciate any help.
    Thanks
    Alessio

    Not that I am aware of, could be wrong though

  • Document level scripting

    I have read about document level scripting -
    This is a nice feature - since it allows a certain level of generalization rather that writing a scriptlet for each objects events.
    I am using Live cycle designer 8.2
    How can I create a document level javascript function ?  i can't see how to do it .
    I am familiar with java scripting and have been scripting for a number of events but i would really like to be able to have a callable function that I pass certain parmeters to for processing.
    please indicate how I can do this .
    Thanks

    You should post this in the LiveCycle Designer forum here, if you haven't already.

  • Document level script to display zeros in calcuated field

    I have created a form, with the calculated fields set to read only, and with a validation script of
    if (event.value == 0) event.value = '';
    (so that the calculated fields do not display as $0.00)
    All but four of the calculated fields are named Item.0, Item.1 etc., plus there are SubTotal, ShippingCharge, CCFee and Total fields that need to stay blank until data is entered into the form.
    Initially, I tried to add the script as a document level script, but it didn't work and I'm thinking it needs more to the script to use at the document level, but I have no idea what more it needs.
    Where did I go wrong?  It certainly would be quicker to add calculated fields if I didn't have to add that validation script to each.

    Even with a document level script you would need to call it in every calculated field.
    I you were to write "app.alert("Hello World");" as a document level function, it would only execute when the PDF was initialized or opened and not again as long as the PDF remained open.
    If you rote a document level function using JavaScript like:
    function Hello() {
    appp.alert"Hello World, I am a function");
    return true;
    It would never run until called  with  a JavaScript statement like "Hello();"
    So even with a document level script and preferably a function, you still would need to edit every calculation to call the function or the script would never run.
    You could also create a document level function to suppress the zero display and then write more code to add the call to this function to the calculated fields.
    You need to learn more about the scope of items, how events are processed within a PDF, what functions are and how to use them effectively. You might want to start with getting or linking to a copy the Acrobat JS API Reference.

  • Total amount of all the items of invoice at document level to present ....

    We have two cubes one is sales document count cube (header data) and other one is sales transation cube (item level data) . Invoice net val is there in sales document count cube and profit center, principal and item category is ther in sales transation cube.
    our requirement is ,total amount of all the items of invoice at document level to present along with principal, profit center & item category.
    This has to be done in the document count cube and not the transaction cube.
    note: multi provider is not solution. There any solution at query level?

    hi
    If your using 2 ODS one for header and one for Item to 2 Cubes.....
    Then just create a update rule between Item data ODS to Document CUbe mapping the new keyfigure ( Net value of total of all items in sales order )
    If not tel me how the cubes and ODS are fed the data
    Assign points if useful
    Regards
    N Ganesh

  • How do I validate a certificate (not visible) at the document level?

    I am using Acrobat XI Pro running in Windows 8.
    I created a PDF document with form fields (type: button) and JavaScript codes (field-level and document-level). Before I certify (not visible) and save the document, I want to add a document-level script that checks if the certificate is valid. If the certificate is valid, I would like to  schedule an interval object to update some of the icons in the fields. Is this possible? If so, how do I get the “certificate (not visible) field” and check that it is valid
    Thanks. - john

    I am using Acrobat XI Pro running in Windows 8.
    I created a PDF document with form fields (type: button) and JavaScript codes (field-level and document-level). Before I certify (not visible) and save the document, I want to add a document-level script that checks if the certificate is valid. If the certificate is valid, I would like to  schedule an interval object to update some of the icons in the fields. Is this possible? If so, how do I get the “certificate (not visible) field” and check that it is valid
    Thanks. - john

  • Document-level javascript quandry

    Ok, completely clueless newbie here whose only coding experience is Access VBA…from a few years ago. Need to write up some Javascript to make this work – that was a month’s worth of a migraine.  I ask for your patience, and would like to ask for forgiveness in advance for any headaches I induce while you try to figure out my problem(s).  Also, I’m not sure how to copy paste images or code examples, but I will do my best.
    So, basic premise:  make a drop-down combo box that will populate another combo box based on whatever was selected in the first box – in this case, 31 items in the ‘Inventory Parts Used’ list, and a total of 427 respective sizes in the other list. 
    YES, I’ve already looked at that http://acrobatusers.com/tutorials/js_list_combo_livecycle1 example, and followed it closely.  Took me forever, but I somehow got it to work. Was very happy.  Only thing I couldn’t figure out was the export value b/c mine wasn’t a number.  But I solved that by putting the CodeID and respective PartSize together (ex: 4-inch Fire Hydrant would show up as "FH-01:  4"). Anyways, I selected that working row and choose the “Place Multiple Fields” option times 15 rows.  Still working.  I’m dancing a jig. Then I tried to check on the code: 
    “Text cannot be displayed in full by the Edit Dialog.  Please use an External Editor.” 
    Uh… So I deleted a row at a time until I could see what my limit was.  I had to pare down 15 rows to a measly 3 rows.  Took me a while but I was able to see where the problem was.  Instead of being written into the Document-Level JS, my array was tied to the first combo box’s Keystroke event on the Field Level.  So when I multiplied the rows, that humongous list essentially had diarrhea.
    I’ve tried to delete that header and keep it to Document Level.   It basically ignored me and keep those lines.  When I did manage to make the <Document-Level> on top, it just didn’t work.
    (    //<AcroForm>
    //<ACRO_source>Row0.InvPart:Keystroke</ACRO_source>
    //<ACRO_script>
    /*********** belongs to: AcroForm:Row0.InvPart:Keystroke ***********/    )
    I’ve searched other forums about the Document-level…. I swear I read a lot of forums that said using Advanced>Document Processing>Set Document Actions>Edit All was ok. Clearly it’s not ok, especially after I found this forum: http://answers.acrobatusers.com/Where-I-enter-document-level-javascript-adding-FormRouter- Calendar-q55527.aspx. 
    So I guess my question(s) is this:  IS that “Edit Document Javascripts” really necessary?  B/c I’ve looked and I don’t have it. I’m using Adobe Acrobat 9 Standard, ver 9.5.5 (and I’m using Windows XP Pro ver 2002 , if that matters).  Is this JS editor only available to the Pro version?  Would it really be a bad thing to just leave it alone as a keystroke event (aside from the unwieldy large, duplicated codes it vomits as a result)? Or maybe, is there a way to code a new row on instead?  I remember seeing an example where you can add more lines as needed, but I can’t for the life of me find it again.
    Thank you in advance for all your assistance.

    * Huh....it just figures... right after I finally give up and post up a question, I would find the answer. =_=;; http://forums.adobe.com/message/4727325#4727325. 
    So, Standard version apparently doesn't have that exalted “Edit Document Javascripts”.  Apparently a way around it is using the Page Open event.  Well, it works - the massive array only shows up once in the editor, and the multiple rows each call the function instead.  Nice. 
    Well, I will leave this up in case someone else can use the reference.  Thanks to anyone who read this and was going to answer me. =)
    Don't suppose anyone knows how to create a code to add new rows instead of having 15 rows straight off the bat?  Or should I make a new post for that?

  • Document-level Javascript as Object

    I created a document level script called Utility.
    I want to create methods within this script rather than coding each one separately.
    function Utility()
    this.getFormattedDateOnly=function(pDate) {
      if (typeof pDate == "undefined") {
        pDate = new Date();
      var retval = util.printd("m/dd/yyyy",pDate);
      return retval;
    this.getFldsOnPagenum = function(pPageNum, pDoc) {
      /* returns an array of the form fields who are on or start on a page */
      /* zero based return ; however pPageNum is 1 thru numPages, not 0 -> numPages-1 */
      var currPage;
      var currFld;
      var cnt = -1;
      var ARflds = [];
    CPR("# flds=" + pDoc.numFields+" Type of pDoc:"+ (typeof pDoc));
      for (var i = 0; i < pDoc.numFields; i++) {
        currFld = pDoc.getNthFieldName(i);
        if (typeof currFld.page == "number") {
    CPR("page="+(1*currFld.page+1));
          if ((1*currFld.page+1) == pPageNum) {
            cnt++;
            ARflds.length = cnt + 1;
            ARflds[cnt] = currFld;
    CPR("\n cnt="+cnt);
        } else if ((1*currFld.page[0]+1) == pPageNum) {
          cnt++;
          ARflds.length = cnt + 1;
          ARflds[cnt] = currFld;
      return ARflds;
    var MyUtil = new Utility();
    This is all working fine with the following exceptions:
    1) the methods are not being registered in the Javascript hierarchy listing.
    That's annoying.
    2) "This" is not recognized at the document level....I must pass it as a parameter (pDoc).
    I thought that was strange...I could see it if were at the folder level.
    It appears the document object is out-of-scope !!
    3) currFld = pDoc.getNthFieldName(i);
    The above is failing....sending back a "currFld is undefined" error.
    I don't see the problem....very strange IMHO.
    When I call the getNthFieldName function from the console....no problem.
    What am I doing wrong in the definition here ?
    It appears that what I did has Acrobat functions and document properties out-of-scope.

    I think this would work if you could make the document object a member of the Object being created.
    To do that, a constructor needs to be invoked so that it can instantiate a public property of the Object.
    var MyUtil = new Utility(this);
    inside of Utility I would have:
    this.oPDFdoc =  this;
    thereby transferring a reference to the entire PDF document to my Object.
    Getting this to work would eliminate the need for all of the document-level javascript references.

  • Add application and document level events using javascript

    Hi All,
    I need to do some validation in the preprint event of the pdf document. There are samples available using the UI and adding the script in the script dialog, but my requirement is that i need to map the 'preprint' event and event handler to the pdf document using pure javascript code without the UI. Any help would be greatly helpful. Thanks in advance.
    Regards,
    Charan

    You can write a document-level function into the actions handlers using the doc.setAction() method from a folder-level script, but one folder-level script cannot create another.
    Suppose you have a folder-level function triggered by a menu item, and it has collected a reference to the active document as oDoc:
    var myScript = 'console.println("I am about to be printed and I have " + this.numPages + " pages" );';
    oDoc.setAction("WillPrint",myScript);

  • Document-Level PostScript example in 01/04 Spec

    I need a little bit of help in understanding the syntax used in the new spec on page 87, for "Document-Level XMP in PostScript". If there's another document that contains the answers to to following, I'd really appreciate knowing where to look.
    Firstly (though this is from page 86), where should the %ADO_ContainsXMP comment go? I know that it's supposed to go in the PostScript header, but how does that fit with XMP if it isn't part of the XMP Packet?
    Second, I want to much better understand the construction of pdfmark. Is there a particular header file somewhere in the SDK from which I'd be able to glean a better understanding of the construct? I have a similar curiosity about "currentdistillerparams". Is this covered in the PostScript spec by any chance?
    Please forgive my lack of clarity, but I really need to better understand what has been written.
    Thanks,
    Tim

    * Huh....it just figures... right after I finally give up and post up a question, I would find the answer. =_=;; http://forums.adobe.com/message/4727325#4727325. 
    So, Standard version apparently doesn't have that exalted “Edit Document Javascripts”.  Apparently a way around it is using the Page Open event.  Well, it works - the massive array only shows up once in the editor, and the multiple rows each call the function instead.  Nice. 
    Well, I will leave this up in case someone else can use the reference.  Thanks to anyone who read this and was going to answer me. =)
    Don't suppose anyone knows how to create a code to add new rows instead of having 15 rows straight off the bat?  Or should I make a new post for that?

  • Document level Data and Item level data

    Hi,
    Can anyone please explain the difference between Document level data and Item level data for sales order.
    Thanks
    shalini

    Item is the lowest level detail of the order. For ex it would be a particular material. Document would be the overall "top" level. Usually refered to as header level. It relates to everything in the document. 
    pts appreciated

  • Document Level Javascript

    Is it possible to create document level javascript ?
    I would like to create a function that I would be able to call in events.
    And is it possible to store an object (like an ADBC connection) at the document level to access it where I want ?
    Thanks.
    Laurent

    There is something called "script object". The script object is an object that you can use to store JavaScript functions and values separately from any particular form object. Typically you use the script object to create custom functions and methods that you want to use as part of scripts in many locations on your form. This technique reduce the overall amount of scripting required to perform repetitive actions.
    To add a new script object to your form:
    - Create a new form or open an existing form.
    - In the Hierarchy palette, right-click either a form-level object or a subform-level object and select Insert Script Object.
    - You can rename your script object (optional) by right-click the script object and select Rename Object.

  • Change Validation to complete document level

    SAP experts,
    In tcode F-65 the business is using account assignment model to post recurring entries by filling in the template. Here it has a validation "Amount is Zero - line item will be ignored" at the Line item level. Business wants this validation to be changed from Line item level to the whole document level (at the time of save).
    The message no. is -- FX090
    "Amount is Zero - line item will be ignored"
    How can I change this validation settings?... please help asap.
    Thanks in advance.

    Dear Sameer,
    You would need to implement it at header level.
    For example in IMG under
    Financial Accounting -> Accounts Receivables and Accounts Payable -> Business Transactions -> Posting with alternative Reconciliation accounts -> Carry out and check document settings -> Validation in Accounting Documents.
    You can see some of the validations are implemented at item level and some at header level.
    Regards,
    Naveen.

Maybe you are looking for