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.

Related Products at PDF Store

Nitro PDF Professional

Nitro PDF Professional, your PDF creation and editing product. Priced at $99, Nitro PDF Pro is the m... View full product details
Download free demo

PDF Snake

Imposes (n-up), stamps watermarks, makes booklets, splits pages, and adds bates numbers. 30-day, unl... View full product details
Download free demo

ARTS PDF Aerialist

Take Acrobat to the next level with advanced splitting and merging; flexible bookmark creation and m... View full product details
Download free demo

PDF In-Depth Free Product Trials Ubiquitous PDF

Nitro PDF Professional

the perfect PDF product for business and enterprise, combining an extremely competitive price with a...

Download free demo

XpdfViewer

This ActiveX control (OCX) provides a PDF file viewer component, enabling developers to add PDF viewing...

Download free demo

Ubiquitous PDF: PDF eBooks-Library

If you are looking for a good store of PDF content, you could do a lot worse than visiting eBooks-Library.com...

September 03, 2009
Search Planet PDF
more searching options...







Download PDF Creator

Download The Best of Planet PDF volume 2
Planet PDF Newsletter
Most Popluar Articles
Features

Collating PDFs using JavaScript

Despite the numerous benefits, there can be potential issues with the conversion of paper documents into electronic archives. When scanning paper pages into PDF, it's possible to end up with the odd- and even-numbered pages in separate PDF files. It can be very time-consuming to collate them manually, but there is an easier way. Sean Stewart explains.

Featured Product

BCL easyPDF SDK

BCL easyPDF SDK is a set of PDF Programming Libraries designed specifically to help Software Developers / Programmers build and deploy enterprise class PDF applications for corporate wide PDF...

Platinum Sponsor
Create & Edit PDF - Nitro PDF Software

ARTS PDF

Silver Sponsors

PDF-Tools enfocus

QuickPDF: The Unrivaled PDF Developer Toolkit