Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

Jacky_Ouyang
Level 1
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
radzmar
Level 10
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

Jacky_Ouyang
Level 1
Level 1

Thanks Radzmar

So there are no ways around it?

arunpriyan89483
Level 2
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!!