Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Embedding and Emailing Attachment

Avatar

Former Community Member

Hi

I just started working with LiveCycle Designer 7.1 and this is my first post.

I need to add an attachment to my PDF and then provide the user with a button that gives them the option to email the attachment only.

The attachment should not be visible to the user but should already be attached (embedded) in the main PDF. 

I came across some code in a document called Acrobat Javascript Scripting Guide.

// Open the file attachment named myFile.xml

this.importDataObject(myData, "/C/myFile.xml");

// Access its contents:

var contents = this.getDataObject("myData");

// Display its contents:

for (var i in contents) console.println(contents[i]);

But I have no idea where to put this code(ie. which event to use, if any)

So in short:

Is it possible to embed the attachment during the design process?.

And how do I just email the attachment and not the entire PDF.

Thanks.

1 Reply

Avatar

Level 6

Oh boy critical task on your first assignment!!!

As you said you want to mail on button click you could add the code in "click" event of the button. However the document open code only opens in Read mode that means no editing possible.

Following is the code I use for emailing the current form data.... replacing XML with PDF in cSubmitAs will submit the current open document as PDF attachment.....do not really know how to attach just one or two attachments rather than the parent document.

event.target.submitForm({cURL:"mailto:"+"xyz@domain.com"+"?subject=emialsubject&body=bodytext,cSubmitAs:"XML",cCharset:"utf-8"});

You can start with this and let us know if you find better way of doing.

Good luck,