Ask a Question related to Adobe Acrobat Macintosh, Design and Development.

  1. #1

    Default Javascript openDoc

    My PDF has a Javascript that opens a new document window. using:

    var otherDoc = app.openDoc("myDoc.pdf", this);

    The script always worked on documents running in acrobat 5 and reader 5 for Mac under OS9 and OSX (but not on Windows).

    In Adobe Reader 6 for Mac, however, the new document closes immediately after opening.

    What's going on? Does anybody have any suggestion how to keep the windows open?

    I also tried creating a new document in Acrobat 6 with the same Javascript command. The same happened.

    j
    JornEbner@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. JavaScript app.openDoc UNC-path?
      Hi! I'm trying to open a PDF-Document (which is stored on a MOSS Sharepoint Server) by using its UNC-Path (e.g. \\mysite.mydom.com...
    2. failed to openDoc call when open from tracker
      when my pdf load follow Javascript is executed: --- console.println( path ); test_doc = app.openDoc( { cPath: path , bHidden: true } ); //...
    3. Include javascript in a javascript file
      Hello, Is there a way to include a javascript file from WITHIN a javascript file? Something similar as in the "#include" directive in C++? ...
    4. need javascript staff (anyone who knows javascript peroid) (READ)
      hey its me ultimategamerx and im back in some clothes lol i need some people who know java script i need help please reply if ya know some
    5. can't find AE opendoc sample code
      the dev apple site either doesn't have -- or has done a good job hiding -- any sample code demonstrating how to handle the AE opendoc event. I...
  3. #2

    Default Re: Javascript openDoc

    George_Johnson@adobeforums.com Guest

  4. #3

    Default Re: Javascript openDoc

    Thanks,

    I did copy the javscript directly from the Acrobat Javascript Guide, for Acrobat 5 and also looked at the one in Acroibat 6 to make sure that there are no changes.

    However, the message is the same, what is vexing is that it works in Acrobat 5 but not in Acrobat 6. The same command, and no apparent changes in the way Javascript is meant to interact with PDF.

    j
    JornEbner@adobeforums.com Guest

  5. #4

    Default Re: Javascript openDoc

    Did you read my first response?

    George
    George_Johnson@adobeforums.com Guest

  6. #5

    Default Re: Javascript openDoc

    Strange coincidence, George, I was just reading about this issue, yesterday, as I was screwing around with my own problems with activeDocs.

    J, there has been a significant change between Acrobat versions <5 and >5.0.5 and the way openDoc and activeDoc function, or not function at all. As you will see in the article mentioned below by Kas Thomas the issue is more complicated than in earlier versions and very unsatisfactory, in particular activeDocs.

    "Doc discovery more difficult in Acrobat 5.0.5"
    <http://www.planetpdf.com/developer/article.asp?ContentID=6297>

    The pages this is discussed in the Acrobat javaScript Reference are pages 50-51 -activeDocs, 75-76 -openDoc, 124 -disclosed and 145 -bringToFront.

    It is unfortunate that Adobe made this decision, they never explained it, one could only hope they would take it back or find a more workable compromise.
    Garrett_Cobarr@adobeforums.com Guest

  7. #6

    Default Re: Javascript openDoc

    Garrett,

    The change that was made between 5 and 5.05 was because of security concerns, and is very reasonable, IMO. If it were not required to set the disclosed property, than any PDF could find out about the existence of any other currently open PDF and extract information from it. Such a situation is *not good* and needed to be addressed. The addition of the disclosed property is a reasonable compromise. Acrobat 6 refined things further, so that it isn't required for a document to disclose itself when the code is run from certain locations (e.g., outside of a document).

    George
    George_Johnson@adobeforums.com Guest

  8. #7

    Default Re: Javascript openDoc

    George, I have no disagreement as to the security implications, the potential for malicious behavior could have been severe.

    I am, with PDF and JavaScript, still an amateur (especially compared to you and Mr Thomas) so I can only evaluate this from the point of view of my experience. That experience is mostly as an interface designer and interactive multimedia designer that has worked with an assortment of authoring-end user presentation type apps.

    For better or worse, that's the lens through which I view Acrobat and PDF. I know others have their lenses as well: print production, batch processing, collaborative document builder, form builder, etc. This multiple use format is what makes PDF so unique among its peers, its like the UN of formats!

    If I run with that metaphor, then its a format where very, very different interests must cohabitate and coexist. The addition or removal of a feature for one cannot do damage to another. I realize that this puts a unique and intense pressure on the Acrobat development team: trying to please so many different interests. But it is a challenge, that in most cases, they have achieved with aplomb.

    In the case of this disclosed property I tend to agree with Kas Thomas that they fell short of a compromise. The subsequent changes in 5.0.5 and 6 to improve it for batch processing does little for the needs of a more portable condition.

    George, as you know, I am working on that InDesign/export PDF button conversion to field thing-a-ma-bob. Since I have a PDF that is behaving as an app to do work on another PDF this situation presents a difficult if not impossible work around.

    I don't want the user to have to install some kind of script in an external js file or insert some code in their target PDF, they may not have the skills or confidence to do this. The idea is to make it portable and self reliant, not more cumbersome.

    It is quite possible that I am missing something, I often do. I was curious about your comment... "Acrobat 6 refined things further, so that it isn't required for a document to disclose itself when the code is run from certain locations (e.g., outside of a document)." Has there been a further change between 5.0.5 and 6 that get's me out of this cul-de-sac?
    Garrett_Cobarr@adobeforums.com Guest

  9. #8

    Default Re: Javascript openDoc



    In the case of this disclosed property I tend to agree with Kas Thomas
    that they fell short of a compromise. The subsequent changes in 5.0.5
    and 6 to improve it for batch processing does little for the needs of
    a more portable condition.




    I understand, but Adobe has to (and does) place security at the very top of their list of concerns. I can't imagine that anything more permissive than the current situation would be acceptable.

    I often do. I was curious about your comment...




    What I meant is what is discussed in the note for the openDoc method in the Acrobat 6 JavaScript reference. That is, disclosed is not required for code executed from a batch, console, or menu event.

    To address your problem, can you provide a few more details about how you want your PDF to interact with other PDFs? Note that it's possible of create a simple batch sequence that can add the required code (this.disclosed = true) to a collection of PDFs, so that it would be minimally painful for your users.

    George
    George_Johnson@adobeforums.com Guest

  10. #9

    Default Re: Javascript openDoc

    George, I found a PDF presentation on Planet PDF by Robert Anderson, "Acrobat External Scripting"

    <http://www.planetpdf.com/mainpage.asp?webpageid=1861>

    On page 12 was this slide...

    JavaScript “disclosed” JavaScript “disclosed”

    New doc property in 5.05 upgrade
    Discussed in ReadMe.html
    Hides doc object when files are opened in JS
    Default value is "false”

    And on page 13 was this slide...

    Workaround for JS “disclosed”

    set f to choose file with prompt "Pick PDF file" of type {"PDF "}
    open f

    do script ("this.getPageBox(); // get the crop box for this document")

    Does this make sense to you?
    Garrett_Cobarr@adobeforums.com Guest

  11. #10

    Default Re: Javascript openDoc

    Dear Garrett and George

    thanks for the information - as to whether this is reasonable, I am not sure I aggree.

    What is unacceptable though, is that if it is such an important *Security Issue* that has been refined in Acrobat 6 - WHY IS IT STILL IN THE JAVASCRIPT GUIDE???

    It should have been removed but it hasn't. The command I have been using in my books is still there, and really, this is just a command to open one SPECIFIC pdf from another. So the command isn't meddling with other docs but is a simple open one named doc from another.

    I think this is just not handled very well by Adobe.

    j
    JornEbner@adobeforums.com Guest

  12. #11

    Default Re: Javascript openDoc

    one thing I forgot to mention:

    I am using Acrobat 5.05 and the problem doesn't occur. In Acrobat 6 it does.

    To see what I mean, just create two files, one with a javascript link that calls to open the next using:

    var otherDoc = app.openDoc("myDoc.pdf", this);

    I have not written this Javascript line, it is in the official Adobe Acrobat 6 Javascript documentation. If it is official, it should be working, shouldn't it? Especially since it has been in ACROBAT 5+. The only thing that has changed in the doc, that they now call it

    var myDoc = app.openDoc("myDoc.pdf", this);

    j
    JornEbner@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139