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

Open a pdf which be attached into a PDF

pettysoldier
Registered: Feb 23 2011
Posts: 6

Hi
My requirement is I designed a pdf form , and there is another pdf will attach into the pdf.I will add a button at the pdf form,when i click the button ,I want to open the attached pdf.
 
How can I do?
  
thank you very much

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

this can be done with JavaScript.
Add this script to the click:event of a button.
It looks for the present attachments and if one has the name "TEST.pdf" it will be opened.

  1. var oDoc = event.target;
  2. var oAttachment = oDoc.dataObjects;
  3. var oAttachmentName;
  4.  
  5. if (oAttachment != null)
  6. {
  7. for (var i = 0; i < oAttachment.length; i++)
  8. {
  9. oAttachmentName = oAttachment[i].path;
  10. if (oAttachmentName == "TEST.pdf")
  11. {
  12. app.openDoc(oAttachmentName, this);
  13. }
  14. }
  15. }

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

pettysoldier
Registered: Feb 23 2011
Posts: 6
Hi radzmar,

Thank you very much, It works!
Regards