Debugging in Acrobat 11 (Javascript)

I am attempting to debug a folder-leel script in Acrobat 11 on the Mac.
1.)  Is there any way to preserve, or to quckly re-enter watches and breakpoints between Acrobat sessions?  According to the docs, for folder-level scripts, such information is not persistent between Acrobat sessions and re-adding watches between sessions is tedious when you have more than a couple.
2.)  Is the debugger for Acrobat 11 on the Mac, itself a bit buggy?  I've been having nothing but problems with it since I started attempting to debug a script on the Mac. 
TIA!
John

Folder level scripts are kept in memory and loaded when the Acrobat/Reader application is opened and are not refreashed from the disk file.
The suggested work flow is to develop the script using the JavaScript console and then moving the code to a JS file in the application folder.

Similar Messages

  • Printing a PDF via Acrobat Javascript

    Hi -
    I have a need to print a PDF programmatically, via Javascript.  The PDF is embedded in a Web page.  I use postMessage to communicate with the PDF.
    I've created a simple HTML page with an embedded PDF, and a Javascript link to call my "Print" function. Here's a code snippet:
    <body>
             <a href="javascript:doPrint();">Print</a>
             <object id="PDFObj" data="testPDF.pdf" type="application/pdf" width="400" height="400" />     
    </body>
    In the HTML document's HEAD, I've added the following Javascript which posts the message to the PDF:
    <script language="JavaScript">
            function doPrint() {
                pdfObject = document.getElementById("PDFObj");
                alert("Hello from Javascript...");
                pdfObject.postMessage(["Print", "Print"]);
    </script>
    Finally, I've added an Acrobat Javascript function in the PDF document to listen for the postMessage event:
    function myOnMessage(aMessage)
        app.alert("Hello from the PDF");
           // print routines here
    var msgHandlerObject = new Object();
    msgHandlerObject.onMessage = myOnMessage;
    msgHandlerObject.onError = myOnError;
    msgHandlerObject.onDisclose = myOnDisclose;
    function myOnDisclose(cURL,cDocumentURL)
    return true;
    function myOnError(error, aMessage)
    app.alert(error);
    this.hostContainer.messageHandler = msgHandlerObject;
    Here's my problem: when I test this code and click the HREF Javascript link, I see "Hello from Javascript..." and "Hello from the PDF," so I know the postMessage event is working.  However, I've tried every print command I know in the myOnMessage function, and nothing seems to work:
    app.execMenuItem("Print"); // doesn't seem to work
    this.print(); // doesn't seem to work, even when I pass in all the params, etc
    I've also tried getting print params and passing those in, nothing seems to work.  Am I missing something?  Environement is Acrobat 9 Pro, browser's tested include Chrome 2.0, IE6.  I've attached two files, the HTML bit and the PDF I'm trying to print.  Any help is greatly appreciated!

    You have to be careful when using the ActiveX control to communicate with system functions like printing.  Because it can be embedded in anything that supports ActiveX, some functionality is limited from being called from JavaScript as it may interfere with the host application.
    Check out the IAC API Reference (also included with the SDK) and the methods under AxAcroPDFLib.AxAcroPDF.  There are some print functions in there (like PrintAll) that you can call on the ActiveX control directly, as in from your doPrint() method in your HTML page without using the hostContainer.  You would basically just call:
    pdfObject = document.getElementById("PDFObj");
    pdfObject.PrintAll();
    These methods were designed specifically to work with the ActiveX control when embedded in a host application, and can be used to print a PDF embedded in a web page.

  • How to search a word in PDF using acrobat javascript?

    Hi,
    I need to find a word in acrobat PDF using javascript. I used
    find text("abx");
    select text("abx");
    This doesn't work for me..
    Someone guide me.
    Thanks in advance,
    Poovili V

    I used
    find text("abx");
    select text("abx");
    This doesn't work for me..
    That is not Acrobat Javascript. In the Acrobat Javascript Reference look for the method getPageNthWord.

  • Acrobat Javascript button not loading when PDF is opened in browser

    We have a requirement to have a custom print button in Acrobat Reader 9.1.3. We've created this via a JavaScript file stored in the users application data Adobe javascript folder. The button appears when Acrobat is started up normally and works as expected. However when opening a pdf file via Internet Explorer 7  acrobat is loaded inside the browser but the button does not appear automatically. Instead we need to right click on the tool bar and select Add on tools for the button to appear. Once loaded it works as expected.
    Now I was wondering is there a way to make the button to appear automatically when acrobat is launched from within IE as my users are getting a bit annoyed now. I've been searching all over the place and can't find a solution to this.
    Am hoping someone here might have an idea as to what the problem might be. I've attached the code I'm using below.
    Thanks in advance
    app.addToolButton({
    cName: "myToolButton",
    cExec: "printGreen()",
    cEnable: true,
    cTooltext: "Print to Green",
    cLabel: "Print to Green"
    global.objDoc = this;
    printGreen = app.trustedFunction (
    function()
    app.beginPriv();
    var objPrintParams = this.getPrintParams();
    objPrintParams.printerName = "\\\\burns\\prn-cash-copier";
    objPrintParams.interactive = objPrintParams.constants.interactionLevel.automatic;
    this.print(objPrintParams);
    app.endPriv();

    OK... I'm still puzzled. There seems to be something else that controls whether Acrobat JavaScript runs or not.
    If I'm loading a pdf stream though a http GET, JavaScript in Acrobat is run even when the setting in Edit->Preferences is disabled.
    <body>
        <iframe height=600 width=400 src = "http://<some servlet that returns a pdf stream>" />
    </body>
    If I'm loading the pdf from a file...
    <body>
        <iframe height=600 width=400 src = "<pdf file path>" />
    </body>
    ... the expected warning (that Adobe javascript is disabled) pops up
    The http response in the first case is something like...
    HTTP/1.1 200 OK
    Pragma: public
    Content-Type: application/pdf
    Content-Encoding: no-compress
    Content-Language: en-US
    Expires: 0
    Accept-Ranges: bytes
    Server: Microsoft-IIS/7.5
    X-UA-Compatible: IE=EmulateIE7
    Content-Disposition: inline;filename=<some UNC file path>
    Server: WebSphere Application Server/7.0
    X-Powered-By: ASP.NET
    Date: Tue, 17 Jun 2014 19:19:09 GMT
    Connection: close
    %PDF-1.6
    %����
    2 0 obj
    <</Metadata 36 0 R/Pages 3 0 R/OCProperties<</D<</RBGroups[]/ON[27 0 R]/Order 26 0 R>>/OCGs[27 0 R]>>/OpenAction 29 0 R/Type/Catalog/AA 31 0 R>>
    endobj
    Do you have any idea why this is happening?
    Thanks,
    Radu

  • How to write text file in acrobat javascript

    Hi,
    I need to write a txt file from acrobat javascript. How can i do this?
    My requirement is to get identity mail id and name? Using acrobat javascript i can able to take mail id as identity.email. I get the mail id as alert and in console
    How can i write this mail id to text file?
    Thanks in advance...

    Hi,
    here is a commented program stanza
    var v = this.getField("myTextField").value;
    // Get the contents of the file attachment with the name "MyNotes.txt"
    var oFile = this.getDataObjectContents("MyNotes.txt");
    // Convert the returned stream to a string
    var cFile = util.stringFromStream(oFile, "utf-8");
    // Append new data at the end of the string
    cFile += "\r\n" + v;
    // Convert back to a stream
    oFile = util.streamFromString( cFile, "utf-8");
    // Overwrite the old attachment
    this.setDataObjectContents("MyNotes.txt", oFile);
    // Read the contents of the file attachment to a multiline text field
    var oFile = this.getDataObjectContents("MyNotes.txt");
    var cFile = util.stringFromStream(oFile, "utf-8");
    this.getField("myTextField").value = cFile;
    [signature deleted by host]

  • Examine Document... using Acrobat javascript

    Hi,
    I am using Acrobat 9 version.
    I have a pdf which has some hidden text. I am using Acrobat menu  Document -->Examine Document... to find if the PDF has any hidden text or not.  If the Examine Document... shows the Hidden text (1 page), then I remove the hidden text using Remove button at the bottom of the examine status window.
    My question is, it is possible to do this task using Acrobat Javascript.
    I am having more than 500 PDFs, so opening each and evert PDF and examining the documnet takes more time. If there are options in Javascript, please let me know.
    Thanks,
    Gopal

    Thanks for your reply.
    The preflight option "List invisible text objects" does not generate the report saying that the PDF has invisible text objects.
    Also, "PDF names"means name of the PDF document (Ex: sample.pdf). Is there any way to achieve this using Javascript code?
    Thanks,
    Gopal

  • How to execute preflight profile using Acrobat Javascript

    Execute a pre-flight profile using acrobat javascript and  call that function in VB.Net.

    See: http://help.adobe.com/livedocs/acrobat_sdk/10/Acrobat10_HTMLHelp/wwhelp/wwhimpl/common/htm l/wwhelp.htm?context=Acrobat10…

  • Tif files not opening via Acrobat Javascript openDoc() method

    Hi,
    I am trying to open a .tif file via Acrobat Javascript using the following code snippet which I have in config.js file in Acrobat Javascripts folder:
    trustedOpenDoc = app.trustedFunction( function (File)
    app.beginPriv();
      var doc = app.openDoc({
          cPath: File,
          bUseConv: true
    app.endPriv();
    return doc;
    Problem is that openDoc opens up all other images but it has problem with multi page tif files, I mean it does not open some tif files. I have directly tried to open files in Acrobat professional 8/9 from File --> Open but got same result.
    The same happens also with some heavy (above 1 MB) .bmp files but with .bmp files this behaviour is not so frequent, on the other hand .tif files always give the same result.
    Any PDF Gladiator who can save my project deadline!
    Look please; I have this problem for the last 12 days and miserably my project is getting late becoz of this.
    Thanks in advance for the resolution/suggestion.

    You guys are not getting my point.
    I am using Adobe Acrobat Professional 8/9 for creating a PDF that picks up text files and image (Jpg, bmp, tif) files from a network shared folder and inserts them into an empty Template PDF file by making use of Acrobat events through Javascript.
    This all works fine as long I dont include any Tif file and PDF is created successfully.
    Now all other file types including text files, jpgs, gif are opening up but problem is with .tif files.
    You can check this by directly opening image files in Adobe Acrobat Profesional 8/9 from File --> Open menu option.
    Other images will open up but most Tif files won't open in it. Such tif files also not open in "Winodws Picture and Fax Viewer" software but will open in softwares like "Imaging Professional" , "IrfanView" etc, which I think use some special codec for it.
    If you know of any Acrobat plugin that can be incorporated in Acrobat professional and convert these tif files to PDF on the fly, would be of great help or have some any other suggestion you feel is right.
    Thanks

  • Browser Javascript call Acrobat Javascript function

    What I want to do is call a function in Acrobat Javascript by clicking a button in my browser.
    So if you click the browser button it executes a javascript function that calls an acrobat javascript function.
    I found this example:
    Browser javascript
    function printDocument() {
         var pdfObject = document.getElementById(\"PDFObj\");
         pdfObject.postMessage([\"alert\", \"Hello from HTML\"]);
    Acrobat javascript
    In the secure folder (C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Javascripts\kassa.js) my folder level script
    so this is executed for each pdf document.
    this.hostContainer.messageHandler =
         onMessage: function(aMessage)
              for(var i = 0; i < aMessage.length; i++)
              console.println("Recvd Msg[ " + i + "]: " + aMessage[i]);
          onError: function(error, aMessage){ },
          onDisclose: HostContainerDisclosurePolicy.SameOriginPolicy
    This should do the job...
    But if i look at the javascript debugger window(acrobat)
    it shows:
    this.hostContainer has no properties
    9:Folder-Level:App:kassa.js
    this.hostContainer has no properties
    9:Folder-Level:App:kassa.js
    Any solution for my problem?

    hi levi,
    Thank u very much for responding,
    to be precise i have to show the user a small window saying that the excel sheet is being prepared and once the sheet is prepared this window has to be closed. So to open and close this child window i need to use the javascript functions.
    currently my jsp looks this way
    <script>
         function open()
         funciton close()
    </script>
    <body>
    <script>
         open();
    </script>
    include x.jsp //sets the content type to excel
    include y.jsp //writes to the excel sheet
    <script>
         close();
    </script>
    <body>
    My x.jsp looks this way
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-Disposition", "filename=" + "abc.xls");
    response.setHeader("Cache-Control","no-cache");
    response.setHeader("Pragma","no-cache");
    response.setDateHeader("Expires",0);
    response.addHeader("Cache-control", "no-store");
    response.addHeader("Cache-control", "max-age=0");
    The issue is the javascripts are not getting called at all. Is there any other way to solve this. Since i am the beginner in this field i dont have much idea about this. A code snippet will be of great help.
    Thanx

  • Can I call extenal API in Acrobat javascript?

    I have some methods in a dll. Can I call it somehow in in Acrobat javascript?

    Thank you Leo.

  • Question to Adobe: Ruling out non-Adobe viewers via Acrobat Javascript

    Hi,
    ***I would like to address this question to Adobe Acrobat developers:****
    I'd like to add a doc-level javascript (thru another script) that will check the viewer type, and if it neither Acrobat (6 and higher) nor Reader, the document will close.
    So I wrote:
    this.addScript("CheckViewer", "var viewer = app.viewerType;\
         if ((viewer !== \"Exchange-Pro\") && (viewer !==\"Reader\"))\
         {app.alert(\"This Document Requires Adobe Reader or Acrobat Version 10 or Later.\");\
        this.closeDoc(true);}");
    The script is correctly placed in the document, BUT if I open the document in Foxit Reader, for example, nothing happens just because Foxit disguises itself as "Reader". Is there a way to overcome this problem?
    I think, the best way would be to change the Acrobat Javascript API so that  app.viewerType values will be: Adobe_Exchange-Pro, Adobe_Exchange, and Adobe_Reader.
    I would appreciate your advice!

    As you understand, I am not for "breaking millions of existing PDFs". I just need a good solution for a serious problem that can no longer be ignored.
    If I were a Foxit developer (or an Adobe developer), I would tell you what is missing or fails quickly. That's the reason why at the beginning of the post I wrote:
    ***I would like to address this question to Adobe Acrobat developers:****
    In any case, I appreciate your input much!

  • Is it possible to run an action from an acrobat javascript

    I'd like to run an action created in the "Action Wizard", from a javascript.
    Is it possible?
    Otherwise I need a way to save a pdf from javascript, with the same settings as set up in the action (downsample images and discarding objects).
    Can that be done?
    Thanks,
    Andreas

    Thanks for confirming that actions can not be started from Acrobat javascript.
    The suggestion to use preflight for optimized save has been done on a couple of questions similar to mine, but never explained in detail, so I'll just add some detail, while exploring it:
    I didn't know where to find the PDFOptimizer settings for preflight in Acrobat Pro XI, but it's here:
    1. Show the "Print production" pane, by checking it in the small foldout menu in the top of the right hand menu.
    2. Under Print production click Preflight.
    3. from the Options menu in the top right corner of the Preflight window, select Create new preflight profile.
    4. Under "Fixups" you will find many of the Save optimized PDF options, such as Downsample images, and discard object.

  • Read xml file using Acrobat javascript

    Please let me know if a XML file can be read using Acrobat javascript.
    I need to read and store the xml data in a string.
    thanks,
    Sashi

    STEP - 2
    SQL>
    SQL> DECLARE
      2    l_ctx dbms_xmlsave.ctxType ;
      3    l_xml CLOB :=
      4  '<?xml version="1.0" encoding="UTF-8" ?>
      5  <NewDataSet>
      6      <ROW>
      7          <DEPARTMENT>BA52</DEPARTMENT>
      8          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
      9          <LOCATION>Australia</LOCATION>
    10          <MAY_2006>21668</MAY_2006>
    11      </ROW>
    12      <ROW>
    13          <DEPARTMENT>BA501</DEPARTMENT>
    14          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
    15          <LOCATION>China</LOCATION>
    16          <MAY_2006>8166</MAY_2006>
    17      </ROW>
    18      <ROW>
    19          <DEPARTMENT>BA522</DEPARTMENT>
    20          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
    21          <LOCATION>Australia</LOCATION>
    22          <MAY_2006>21668</MAY_2006>
    23      </ROW>
    24  </NewDataSet>' ;
    25  BEGIN
    26      l_ctx := dbms_xmlsave.newContext(targetTable => 'XML_INSERT');
    27      dbms_output.put_line(dbms_xmlsave.insertXML(ctxHdl => l_ctx,
    28                                                  xDoc   => l_xml) ||
    29                           ' rows inserted.');
    30      dbms_xmlsave.closeContext(l_ctx);
    31  END;
    32  /
    3 rows inserted.
    PL/SQL procedure successfully completed.Regards.
    Satyaki De.

  • ACROBAT JAVASCRIPT EN CASTELLANO

    AGRADECERÍA MUCHO SI ALGUIEN ME PUDIERA DECIR CÓMO CONSEGUIR UN MANUAL DE ACROBAT JAVASCRIPT EN CASTELLANO. ES MUY IMPORTANTE PARA MÍ. GRACIAS POR ANTICIPADO.

    It's the Acrobat-specific implementation of JavaScript.  It's built into Adobe Acrobat and Reader.

  • Acrobat Javascript and older versions of Reader

    Hi,
    I have created a basic Acrobat Javascript for my PDFs which reside at the document level.
    What i want to know is, how backwards compatible is Acrobat Javascript? Will it work in older versions of Adobe Reader?
    I have not managed to find much on this so any info would be appreciated.  I just need to make sure the script runs to all my users regardless of what version of reader they are using.
    Is this possible?
    Thanks.

    In addition to George's statement, you might also check the JavaScript version a specific Acrobat version supports; there have been a few useful changes in Core JavaScript 1.7 and 1.8 (in the Array object), which may prevent your script running properly in Acrobat 7 (and older).
    On the other hand, with the exception of "security" annoyances, old code (developed in Acrobat 4 or so) usually still works in Acrobat 10. This means, that you can program for a specific Acrobat version, and it should be fine with several newer versions as well. If not sure, check the documentation (mentioned by George) and try it out.
    HTH
    Max Wyss.

  • Acrobat Javascript get Windows PDF creation time

    Is there a way to get the Windows creation time of a PDF in Acrobat Javascript? When you copy a PDF the Windows creation time changes but the PDF creation time does not. I'm looking for a way to detect if someone copied the PDF.

    I know you can get the PDF creation time through the info object but that isn't what I want. When you copy-paste a PDF in Windows the creation time of the info object doesn't change. It always stays the same so I can't detect a copy that way. I want the creation time that Windows provides. Is that possible?

Maybe you are looking for

  • New LCD Monitor

    Well, I finally got out of the stoneage, and replaced my broken crt with a samsung 22" widescreen, and so far I love it! Small problem though. I'm using DVI cables, and whenever my computer leaves my bios screen, it says something about "not perferre

  • I want messages with attachments to not be sorted and I want to see the attachment icon

    Thanks for sending me the information on showing the attachment icon. I did what you suggested, and it did not work. And now, if I get an email with an attachment, I don't see the email--it is buried somewhere in my inbox. I used to be able to get me

  • Help with linking bank to paypal

    I try to link a bank account and when i do only this comes up http://gyazo.com/bbca31d31822df0b7b674557e01fd89a wt **bleep** is that ? i dont need that . I want to sign in to my online bank so it can link instantly but it is not letting me and it isn

  • Windows Registry error when starting Illustrator.

    I have CS5.5 Master Collection. because of the following problem, I downloaded, last week, all the updates via the website. So Illustrator is now v15.1.0 After the update I get an error every time I start Illustrator that says: Adobe Illustrator [War

  • Mac OS and Application Settings Wiped Out

    Hi folks, I shut down my MBP earlier today and started it up this evening to find that all of my desktop settings, system settings, application settings, and desktop/dock icons are all gone and set to default. It's like I'm using an entirely new prof