Tips & Tricks

Using the JavaScript Disclosed Document Property

November 14, 2003

Advertisement
Advertisement
 

A property of the Doc object of a PDF is the 'disclosed' property (introduced with a patch to Acrobat 5.0). Depending on whether this property is set to true or false determines whether a PDF can be accessed by JavaScript from within other PDF documents. Specifically, if the disclosed property is set to false, you will be unable to access the 'Doc' object of a PDF unless it's the active PDF document in Acrobat.

A typical example of this is using the App.openDoc() method from a PDF link to open a separate PDF document. This would have worked without problems in previous versions of Acrobat, but unless the disclosed property of the PDF you're trying to open is set to 'true', the PDF will NOT open with Acrobat.

To individually set the disclosed property on all your PDFs would be a labourious task if you have more than a handful of PDFs. However, using a little JavaScript and Acrobat Batch Processing you can set this property to true across your whole collection of PDFs. Note: Batch Processing in Acrobat 6.0 is only available in the Professional version.p>

So in Acrobat:

  1. Acrobat 6.0 - Open Batch Processing from the 'Advanced' menu.
    Acrobat 5.0 - Open Batch Processing from 'File > Batch Processing > Edit Batch Sequences'

  2. Click 'New Sequence' and give a name to your new sequence.

  3. Click 'Select Commands' and add 'Execute JavaScript' as the action to execute.

  4. Double click on the 'Execute JavaScript' selection in the right dialog pane and add this JavaScript code to the window. Click ok.

    /* Insert document level JavaScript to set disclosed = true.
       This will run when the document is opened.*/
    
    this.addScript("setDisclosed", "this.disclosed = true;");

  5. Finish creating your Batch Sequence by designating an output location and configuring sequence run conditions. Return to the main Batch Sequences dialog and select your new Batch Sequence to run it on your PDF collection. Once processed, these documents will be accessible from JavaScript in separate PDFs.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Quick PDF Library

Get products to market faster with this amazing PDF developer SDK. Over 900 functions and an equally...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.