Adobe Javascript

I need some help in writing a Javascript macro.
We create many PDF documents from Word by applying the Save as PDF option. We then open each PDF document and edit its file properties.
In the Description tab, we update the Title and Author and in the Initial View tab, we set the parameters as following:
Navigation Tab = Bookmarks Panel and Page
Page Layout = Single Page
Magnification = Fit Page
Show = Document Title.
I have managed to automate the setup of the Title and Author by placing the following Javascript file in the Acropbat Javascript folder:
var SetMetaData = app.trustedFunction(function()
                 app.beginPriv();
                 this.info.author = "Company Name";
                 this.info.Title = this.info.Title + " " + this.info.Subject;
                 this.info.Layout = "SinglePage";
                 this.zoomType = zoomtype.fitP;
                 app.endPriv();
app.addToolButton({
   cName: "applyMetaData",
   cLabel: "MetaData",
   cEnable: "event.rc = (app.doc != null);",
   cExec: "SetMetaData();"});
The Javascript code above creates a button called Metadata. Clicking this button successfully updates Author and Title.
However, I have no idea how to set the four Initial View parameters (see above). The Layout and Zoomtype commands change the appearance of the document but not the values in the Initial View window. Therefore, next time the PDF document is opened, it forgets the Single Page and Fit Page setup and gets back to what it was before.
I will be grateful to get any idea of how to solve this problem.

You can use the undocumented 'pane' property of the 'doc' object.
this.pane = 'none'; // no panes
this.pane = 'n'; // no panes
this.pane = "bookmarks"; // bookmark
this.pane = "b"; // bookmark
this.pane = 'fullscreen'; // full screen
this.pane = 'f'; // full screen
this.pane = "layers"; // layers
this.pane = "l"; // layers
this.pane = "thumbnails"; // thumbnails
this.pane = "t"; // thumbnails

Similar Messages

  • Adobe Javascript buttons does not work after deploying by ADS

    Hi,
    I have a dynamic PDF with adobe javascript " addInstance (1) ". In the preview of Adobe Lifecycle the PDF works like it should. However when I deploy the PDF in Developer studio the button is working anymore. It looks like the PDF isnt dynamic after deployment.
    I have tried to add the following code , but it isnt working:
    IWDInteractiveForm iForm1 = (IWDInteractiveForm)view.getElement("InteractiveForm1");
    iForm1.setDynamicPDF(true);
    Also, the properties of the PDF is set to Interactief Form, and XDP preview format is Dynamic PDF.
    Does anyone know what the problem is?
    Thank in advance.
    Thaibinh
    Application details:
    Acrobat Reader 7.0.9 and higher
    Adobe Live cycle 7.1
    Developer studio S 7.0.13
    AdobeControl version  6.3018.0.1
    Type browser Internet Explorer 6.0
    Operation system Linux
    Type of interact form ACF
    Netweaver 2004s

    Hi Harman,
    Am i inserting the code at the correct spot?
    //@@begin javadoc:wdDoModifyView
    Hook method called to modify a view just before rendering.
    This method conceptually belongs to the view itself, not to the
    controller (cf. MVC pattern).
    It is made static to discourage a way of programming that
    routinely stores references to UI elements in instance fields
    for access by the view controller's event handlers, and so on.
    The Web Dynpro programming model recommends that UI elements can
    only be accessed by code executed within the call to this hook method.
    @param wdThis Generated private interface of the view's controller, as
           provided by Web Dynpro. Provides access to the view controller's
           outgoing controller usages, etc.
    @param wdContext Generated interface of the view's context, as provided
           by Web Dynpro. Provides access to the view's data.
    @param view The view's generic API, as provided by Web Dynpro.
           Provides access to UI elements.
    @param firstTime Indicates whether the hook is called for the first time
           during the lifetime of the view.
      //@@end
      public static void wdDoModifyView(IPrivateInfosessieenqueteView wdThis, IPrivateInfosessieenqueteView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
         if (firstTime) {
         IWDInteractiveForm iForm1 = (IWDInteractiveForm)view.getElement("InteractiveForm");
         iForm1.setDynamicPDF(true);
        //@@end

  • How to create a pop up calendar in adobe acrobat or any other adobe tool  via adobe javascript  ?No third party tools needed(Eg:formrouter)

    I want to create a pop up calendar in adobe acrobat or any other adobe tool  via adobe javascript  in a PDF form .
    I wish to create the calendar without any third party tool.
    I found few options like formrouter and also pdf scripting.
    But I was to create the calendar via pure Adobe Javascript. If no such option is there  inbuilt pop up calendar control in any adobe tool to design the PDF form and afterwards save the same as PDF.

    All 3 of the options provide are all JavaScript. There is no plug-in used. You do need to place the JavaScript code text file into a special folder so that the menu and tool bar tools that allow execution of the JavaScript code and associate the pop-up calendar with a specific field.

  • Adobe Javascript in PDF Form for replacing special character

    How to replace special character "/"  in to "\" in the text field of PDF Form by using Adobe Javascript.

    In PDF Form java script,  returns the file path with "/" forward slash, but need to get default in "\" backward slash in the file path.

  • How to read a text file using adobe javascript

    Hi,
    I have a api application which adds toolbar to a adobe acrobat. i need to disable the toolbar according to expiry date, So i need to fetch the expiry datge from a text file from the specified location.
    I am using importTextData() function to get the textdata from text file using adobe javascript. When i call this function i am getting error "ReferenceError: importTextData() is not defined".
    I am using Adobe Acrobat 7.0 version.
    Can any one tell how to use the importTextData() function.
    Regards
    Shiva

    calling from javascript file which is placed in the below location.C:\\Program Files (x86)\\Adobe\\Acrobat 7.0\\Acrobat\\Javascripts
    Regards
    Shiva

  • Getchar() and putchar() in adobe javascript

    One of the simplest programs that are written in C for newbies is pure input  and output of characters from pressed keys in succession (with some max  repetition allowed by the operating system settings for key pressed for extended  period).
    #include <stdio.h>
    main(){
    int c;
    while ( (c=getchar()) != EOF)
         putchar(c);
    I want to write a similar minimal program in acrobat  javascript.
    The script may be document/application level ... most preferably not attached  to any specific field on any page and listens for the Keystroke ... ie a pressed  key.
    However, if it MUST be attached to a field ... then that field would be a  button field which is on the current page and in focus ... but this will take  away the simplicity I desire and as exhibited in the C program above which  compiles and works.
    I want to print the letter corresponding to the key pressed on the console  using this statement or another ...
    console.println(c);
    [QUESTION] How do I read the key pressed ?
    Thanks,
    Francis Fukuyama
    Re: getchar() and putchar() in adobe  javascript
    as a newbie i did lots of search in the sdk and guide before asking this  question.
    i need acrobat to do events globally irrespective of page based on what key  is pressed in certain contexts so it should not interfere with other normal  operations.
    alternatively, i need three of four modifiers of mouse events but  nothing is more convenient on the fingers than pressing a key like y/n for  yes/no .
    Are there any non-reserved keys or non-reserved clicks events that can be  recorded at the global, application or document level, or else be intercepted by  a button and then recorded in some kind of file or hidden field for that button  and then automatically "recorded or downloaded" into a text file as a data ?
    Thanks again for any help.
    Francis
    George Johnson
    1,505 posts since 
    Aug 11, 2002
    2. Dec 17,  2010 11:03 PM in response to: FrancisFukuyama
    Re: getchar() and putchar() in adobe  javascript
    You would have to create a custom plug-in to have any hope of accomplishing  this. JavaScript cannot do what you describe. You might want to pose this  question in the Acrobat SDK forum here if you haven't already.

    Francis,
    The SDK documentation is sufficient, I learned plugin development just from reading all the relevant documents. The SDK comes with sample plugins that you can use to start your own project.
    However, your development environment will not be sufficient to develop Acrobat plugins: you need Visual Studio on Windows and XCode on the Mac. Which version is necessary depends on which version of the SDK you are using.
    The PDF reference is the document that describes The PDF file format, and is necessary if you want to access information in a PDF, add to, or modify a PDF. Since the PDF format is no longer owned by Adobe, but is now an international standard, that document is available as ISO32000 through ISO, but you can still find the previous version on Adobe's web site.
    Plugin development is complicated, don't expect to learn it in an afternoon or a week or even a month.
    Karl Heinz Kremer
    KHKonsulting LLC
    PDF Acrobatics Without a Net
    [email protected]
    http://khkonsulting.com

  • Detect device where pdf is being viewed using adobe javascript

    How can I detect whether a PDF file is being viewed in a Mobile device or PC? Is it possible through Adobe JavaScript API or something else?

    Not really a Reader question but more of an advanced Javascript/HTML question.
    Are you trying to serve up a different pdf depending on what they are using? Something else?

  • How can I disable Select Tool & enable Hand Tool using Adobe JavaScript ?

    How can I disable Select Tool & enable Hand Tool using Adobe JavaScript ?
    I want wherever the PDF opened automatically preferrence changed, default HAND TOOL remain selected. I want to do it using Adobe JavaScript.

    You are correct in that it's not functioning, however I do not have that option under the "online and adobe online" section in Adobe Customization Wizard XI.  I have the following boxes that can be checked:
    "Disable initiating shared reviews and data collection via distributed forms using Adobe online services (does not affect non Adobe online services reviews and forms).
    "Disable the Tools pane in Reader"
    "Disable file storage on Adobe online services"
    "Enable file storage even when all other services are disabled"

  • Adobe Javascript from within Excel VBA

    I have some limited experience with Excel VBA and Adobe Javascript separately, but have never tried to put them together. I am rather baffled by the use of “DoJavaScript” from within Excel VBA. I have a number of Illustrator JavaScripts that do various tasks (mostly measure and set properties on illustrator drawing objects to determine some geometric metrics). I wanted to run these scripts from within Excel VBA (they run without problem when directly called into Illustrator). My hope was to pass a few real numbers from VBA into the JavaScript before one ran to set some run parameters and then get a few real numbers back out from the JavaScript back into VBA. I cannot seem to get even the simple DoJavaScript command given in the Adobe VBscript reference to run. Reading other posts that seem somewhat related it is not clear if I am doing something very simple wrong, or if my understanding of the use of the DoJavaScript command is misguided. Anyone able to shed some light on this?
    My last try was this simple test...almost directly from the Adobe reference:
    Private Sub SetScale_CommandButton1_Click()
    Set appRef = CreateObject("Illustrator.Application")
    Set myNumberOfDocuments = appRef.DoJavaScript("documents.length;")
    MsgBox myNumberOfDocuments
    End Sub
    I am really hoping to be able to run javascripts that are a few hundred lines long....but if I cannot even get something simple to go then I am about to give up on it.
    Thanks for any suggestions

    Carlos;
    I am most grateful! ... I was stumped on that for hours, thought I had tried about every combinatory possible, and was about to give up on getting the DoJavaScript  method to work. There are few examples of this on the web, so for anyone else who would like a bit more verbose  example I post below is a simple VBA sub-routine that uses a javascript function to return the number of selected objects in the current active illustrator document and displays that number in a message box in excel. Simple example, but it was the sort if thing I was looking for all over the web before Carlos’ help.
    Cheers,
    Brian
    Private Sub ObjectNum()
    Set appRef = CreateObject("Illustrator.Application")
          tmp$ = "function myfunction() {"
          tmp$ = tmp$ + "var idoc = app.activeDocument;"
          tmp$ = tmp$ + "var sel = idoc.selection;"
          tmp$ = tmp$ + "var numobj = sel.length;"
          tmp$ = tmp$ + "return numobj;};"
          tmp$ = tmp$ + "myfunction();"
    numobj = appRef.DoJavaScript(tmp$)
    MsgBox numobj
    End Sub

  • How to open an URL and close the URL window, using adobe javascript

    Hi,
      Is it possible to open an URL and close the URL back again(without allowing the user to perform any other operation)? I was able to acheive the opening of the URL, using the app.launchURL("address". true); - But here it lauches in new window, and how do i close the window using the javascript. Is it possible?
    Thanks.

    Hi all
    In addition to what Bobby W - Adobe TS added, you might find
    the following useful as a bypass or workaround to the pesky prompt.
    var pw=window.parent;pw.opener=window.self;window.open("
    http://www.adobe.com");
    pw.close();
    I think this will only work for IE browsers. Actually, I
    think the whole window.close() only works for IE, but could be
    wrong about that.
    Cheers... Rick

  • Newb deserving assistance with Adobe Javascript (check boxes and combo boxes)

    Hi, I'm a newb when it comes to javascript (using adobe acrobat pro 6.0).
    I am working on a form that will allow me to autofill checkboxes based off of information chosen. Ideally, I would like to have a selection from a combo box autofill/auto checkmark check boxes. Alternatively, I would be willing to just have different selections presented with check boxes that when filled, would auto checkmark other check boxes (I know how to do this one, but I am not sure how to clear the check boxes if the initial one is unchecked).
    I have the action button tied to the mouse up function. This just errors out.
    var Citrix = this.getField("Citrix")
    var Appro = this.getField("Appro")
    var SAS = this.getField("SAS")
    if (event.target.value=="Yes") {
    Citrix.checkThisBox = true
    Appro.checkThisBox = true
    SAS.checkThisBox = true
    else {
    Citrix.checkThisBox = false
    Appro.checkThisBox = false
    SAS.checkThisBox = false
    I have this that works, but I don't know how to clear the buttons when "Associate" is unchecked.
    if(this.getField("Associate").isBoxChecked(0));
    this.getField("Citrix").checkThisBox(0, true);
    this.getField("Appro").checkThisBox(0, true);
    this.getField("SAS").checkThisBox(0, true);
    The other way I was working on it, was to use a combo box to autofill/checkmark check boxes. But this code doesn't work either.
    function calculateTextField()
    // get the value of the combo box
    var comboValue = this.getField("Select").value;
    // get the state of the checkbox
    var isChecked = (this.getField("Citrix").value == "Yes");
    var textFieldValue = "";
    console.println(comboValue);
    if (isChecked)
    if (comboValue == 0)
    textFieldValue = "";
    if (comboValue == "Associate")
    (this.getField("Citrix").value == "Yes");
    else if (comboValue == "Specialist")
    (this.getField("Citrix").value == "Yes");
    else if (comboValue == "Team Leader")
    (this.getField("Citrix").value == "No");
    else
    (this.getField("Citrix").value == "No");
    else
    textFieldValue = "";
    this.getField("Select").value = textFieldValue;
    Can anyone please assist me with this?
    Thanks,
    Chris

    Hi Gene,
    Thank you for the response. Are you saying that my initial formula should look more like this; ?
    var Citrix = this.getField("Citrix")
    var Appro = this.getField("Appro")
    var SAS = this.getField("SAS")
    if (event.target.value=="Yes") {
    Citrix.checkThisBox = true
    Appro.checkThisBox = true
    SAS.checkThisBox = true
    else {
    if (event.target.value=="Off")
    Citrix.checkThisBox = true
    Appro.checkThisBox = true
    SAS.checkThisBox = true
    Thanks,
    Chris

  • Adobe JavaScript printing page selection

    Hello,
    1) I succeeded printing documents using JavaScript with pp.firstPage and pp.lastPage. Now I would like to print several single pages (e.g. pages 4, 7, 10) within a single print job.
    If I make several print jobs, the paper is ejected after each job. This should not happen, as I want to print in duplex mode.
    Does anyone know, how to do this?
    2) In the internet I could only find the JavaScript documentation for Adobe Version 6: https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/Acro6JS1.pdf
    Is there any newer version?
    BTW: I am using the free version of Adobe which does not support all features.
    Thanks for your help!

    Thanks to Bernd Alheit and GKaiseril  !
    The docu for Version 11 is:
    http://help.adobe.com/livedocs/acrobat_sdk/11/Acrobat11_HTMLHelp/wwhelp/wwhimpl/js/html/ww help.htm?&accessible=true 
    In the new docu for Version 11 I found the parameter which I looked for:
    With PrintParams::printRange it is possible to print any selection of pages just in one print job. Multiple printing of a special pages is possible too.

  • Webdynpro and Adobe Javascript

    Hi All,
    I have a webdynpro for Java program with an Adobe form embedded as an UI element. This Adobe form has javascript for validations.
    Now, my web dynpro has a submit button and on click of this submit button, I need to invoke the xfa.form.execValidate() so that all javascript validations on the form are executed.
    How can I perform this task? Kindly advice.
    Thanks in advance,
    Best regards,
    Divya

    can you put xfa.form.execValidate()  in interactiveform load event?
    nikhiL

  • Call ActiveX (OCX, DLL) in Adobe JavaScript

      Hi,
        I want to create a new instance for custom ActiveX (OCX, DLL) in JavaScript for Adobe, how can I do it?
        Calling functions CreateObject("MyOCX.document") or ActiveXObject("MyOCX.document") does not work.
    Thanks in advance,
    Zbigniew

    Ok, thank you.
      Is it possible to call an external program from custom menu item?

  • Adobe Javascript MAC and PC

    We are programming an application using Adobe' s javascript.
    The resulting PDF needs to cross platform compatibe ( ie be able to be view on PC's and MAC) with the javascript functioning.
    If there a differnce in programming needs for javascript to function in both PC and Mac readers?
    If so can anyone point me to any Adobe documentaion that offers infomration on that.

    There are some differences, but not many.
    You can find the reference here: http://www.adobe.com/devnet/acrobat/javascript.html
    (ps. In the future, you're more likely to get an answer to such questions if you post them on the Acrobat Scripting forum)

  • Adobe javascript include "this.saveas" into the pdf document level

    Hello,
    in some posts i read that if i certify a pdf, i would be able to include doc.saveas into the pdf document level. 
    Can anybody tell me what kind of cerify i'd need and how to have it done to make the saveas work from client side?
    thanks alot

    When you use the saveAs method with code inside the PDF, do not place it in a trusted function or use app.beginPriv/app.EndPriv. You have to confirm that the certificate is in your list of trusted certificates and that it is trusted to allow execution of high privilege JavaScript. Be sure to test the document with Reader and validate the signature before attempting to execute the code. There is a preference that controls whether signatures are validated when a document is opened. I would recommend setting this preference.
    I would suggest testing it with Reader.

Maybe you are looking for

  • Problem with SystemTray on FC5 KDE

    Hello! I'm trying to use new Java6 feature - SystemTray. There is problem with it on my Fedora Core 5 in KDE - system tray icon simply goes crazy (it appears and disappears, mainly disappears :( , sometimes it is moving on system tray in random direc

  • Convert date "yyyy-MM-dd" to "MM/dd/yyyy"

    Hi, First of all thank you for helping in advance. I am a new rookie in Java language. However, I have question regarding to converting the date format that I get from mysql to the regular US display date format. The question is I got the date from m

  • Reverse GR for production order

    Hello, I need few steps to reverse the GR for Prod.ord. 1) Prod.order confirmed, GR done 901 storage with dynamic bin. 2) TO is created and moved stock from 901 ST to finished goods own ST and bin. Now user realised he did some mistake. 3) Tried TO t

  • Hi Are there any known compatibility issues with Lopic Pro 9 and Adobe PDF 9?

    Hi I am am Using a MacPro OS 10.5.8 2x2.66 GHz Dual-Core Intel Xeon and Logic 9.1.5. Also Adobe PDF 9.0 I can't print my score to pdf. The print box openes but The print button and the preview butten are not responsive! Is any body else experiencing

  • Shopping cart in flash 8

    I made a Flash website of online shopping. I used PHP as a getway.My problem is, when I adding a new iteam to the cart, then flash sending a id to the php and on the base of this id php re write the xml or updating the xml. The php part is working fi