Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript API for Adobe Acrobat - how to create a relative link to a non-PDF document with JavaScript?

My company wants to set up some PDF documents to track projects. We want to create links inside the PDF that, when clicked, open a given document (.doc, .xls etc) using a relative path.

There is the app.openDoc JavaScript method, however that only works for PDF files.

There is the "Open a file" action, but that seems to work for only absolute paths.

I've looked into the API ( http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf ) to no avail ... does anyone know how to do this?

like image 676
Jordan N Avatar asked Dec 11 '25 02:12

Jordan N


1 Answers

The doc object has no such method, but you can do the following:

  • Convert the .doc or .xsl file to .docx or .xslx
  • Attach the XML file to the PDF
  • Use the Doc.getDataObjectContents() to read the data

As an alternative, you can also use the util.readFileIntoStream method in a closed environment where you can install folder-level scripts on everyone's system.

like image 56
Paul Sweatte Avatar answered Dec 12 '25 15:12

Paul Sweatte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!