Expand my Community achievements bar.

Script enable Attachment in PDF using liveCycle and users can enjoy the function with Adobe Reader?

Avatar

Level 1

Hello Everyone

I have a question on attachment please.

I am current working on a PDF that requires users to attach multiple files (e.g. Invoices). After reading so many posts, I still confuse about is that even possible.

This PDF form is created from LiveCycle but all other users are using adobe reader. Examples I found online seems only works with Acrobat and the function can't even fire up in adobe reader. If I would like to use the comment attachment function in adobe reader, the form must be flatten first and that will defeat the purpose of using PDF Form.

Ideally, it would be great if I can combine the pdf form and the other pdf files instead of attaching it, but i don't think it will work for users when they are using adobe reader.

Does anyone have an idea on how can I program the attachment function using LiveCycle designer, that allow users to attach and retrieve in their adobe reader please?

Many Thanks.

----- Codes I found that is close to what I wanted to do, but does not work on adobe reader-----

//==Attach==

var myDoc = event.target;

var sFile = "myFile" + NumericField1.rawValue;

myDoc.importDataObject({cName: sFile});

var myDataObject = myDoc.getDataObject(sFile);

var sFileName = myDataObject.path;

ListBox1.addItem(sFileName,sFile);

NumericField1.rawValue = NumericField1.rawValue + 1;

//==Retrieve==

try{

var myDoc = event.target;

var sFile = ListBox1.rawValue;

myDoc.exportDataObject({ cName: sFile, nLaunch: 2 });

}

catch(e)

{

app.alert("There are no files to open");

}

//==Remove==

Untitled.#subform[0].Button3::click - (JavaScript, client)

try{

var myDoc = event.target;

var sFile = ListBox1.rawValue;

app.alert(sFile);

myDoc.removeDataObject(sFile);

ListBox1.deleteItem(ListBox1.selectedIndex);

NumericField1.rawValue = NumericField1.rawValue - 1;

}

catch(e)

{

app.alert("Error in removing document");

}

xfa.layout.relayout();

3 Replies

Avatar

Level 10

To enable Reader to add/remove attachments you need LiveCycle Reader Extensions, which is a very expensive module for LiveCycle server product (not LiveCycle Designer!).

Understanding Reader Extensions > Adobe LiveCycle Designer: Working with PDF and Acrobat

Avatar

Level 1

Thanks Radzmar

So there are no ways around it?

Avatar

Level 2

Hi,

I'm creating PDF form and trying add the attachment which is excel file in adobe livecycle designer ES8.2

The excel should converted to XML data while submitting the form. Could you please share script for this.

Appreciated your help!!