These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Calling webservice to retrieve and open PDF file

sc_wizard29
Registered: Jan 12 2010
Posts: 3

Hi everyone,

Today my manager asked me to check if it was possible to "use acrobat to connect to a webservice that returns a PDF document and to display this document".

The "javascript developer's guide" talks about retrieving a "readStream" object : can this object be converted to a PDF file and opened in Acrobat ?

Any help or pointer to a code sample or tutorial would be greatly helpfull.

Thanks for helping !

Bob.

My Product Information:
Acrobat Standard 9.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, but it's not a straight forard opperation. The read stream has to be placed into a context where Acrobat will recognize it as a file. For example, you could write the stream to an attachment, i.e. a Data Object using the "doc.setDataObjectContents()" function. If necessary you can also create a new DataObject of the correct type for this operation. Then use the "doc.exportDataObject()" fucntion with the "nLaunch" argument to open the file.

This methodology will only work in Acrobat Pro, or with a PDF that has very special Reader Rights Enabling. And the PDFs should be small. It may not work for files over 32k because of object size limits in JavaScript.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

sc_wizard29
Registered: Jan 12 2010
Posts: 3
Thanks for your detailed answer thomp... the file size limitation looks like a big problem : it will try to investigate a bit more.

Thanks again !