Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

how to retrieve attachments from a PDF?

Avatar

Former Community Member

Hi All,

how do i retrive attachments in a pdf using workbench process?

I have used a DDX file which is :

<?xml version="1.0" encoding="UTF-8"?>

<DDX xmlns="http://ns.adobe.com/DDX/1.0/">

<FileAttachments result="attachmentInfo.xml" nameKeys="*" extract="true">

<PDF source="inDoc"/>

<FilenameEncoding encoding="ISO-8859-1"/>

</FileAttachments>

</DDX>

Now i got the attachmentInfo.xml with the informartion of all the attachments.

My problem is how to actually get hold of the attachments inside the PDF.

Pls help.

Thanks

Abhiram

1 Accepted Solution

Avatar

Correct answer by
Level 8

The trick to this is in the results that the DDX returns.   When using the FileAttachments tag in a DDX the result is not just the attachments, but also an XML that describes the attachments. 

http://livedocs.adobe.com/livecycle/8.2/ddxRef/000663.html

The description file (identified using the “result” attribute in the DDX) goes into a Map stored in AssemblerResult.object.documents.   The extracted documents are also stored in this map. 

By reading the description XML file you can tell the file name, content type and location (key) of the attachments. A simple loop is used to read the XML file, find the attachments (by the key in the Map) and write them to the file system.

View solution in original post

4 Replies

Avatar

Correct answer by
Level 8

The trick to this is in the results that the DDX returns.   When using the FileAttachments tag in a DDX the result is not just the attachments, but also an XML that describes the attachments. 

http://livedocs.adobe.com/livecycle/8.2/ddxRef/000663.html

The description file (identified using the “result” attribute in the DDX) goes into a Map stored in AssemblerResult.object.documents.   The extracted documents are also stored in this map. 

By reading the description XML file you can tell the file name, content type and location (key) of the attachments. A simple loop is used to read the XML file, find the attachments (by the key in the Map) and write them to the file system.

Avatar

Former Community Member

Thank you so much for your help..

I have one more requirement :

A PDF has multiple subforms(same instance being added) and that subform contains an attach file button.

Now I want to extract these attachments in the subform level rather than form level because i want to write each subform files in separate folders.

Is this Possible?

Note: i have an another field in that subform which is having a unique value along with attach file button inorder to distinguish the subforms.

Hope I am clear.

Thanks

Abhiram

Avatar

Level 8

AFAIK Acrobat only has one location to store attachments.  Although the subforms may each have an attachment button, the attachments are all going to the same place in the PDF.

If you need to identify what attachments are in what subform you may need to add an identifier to the attachment by using either the attachment name or description.  For example you may tag all the attachments with the sub form name as the description.

Avatar

Former Community Member

can you be more specific regarding the description of the attachment. how to add the description to the files in the same subform?

And also, Can i change the name of the attachment to our convinience after the user has attached any file?

Thanks.