DDX converts attachments to PDF | Community
Skip to main content
Level 2
October 13, 2021
Solved

DDX converts attachments to PDF

  • October 13, 2021
  • 2 replies
  • 3110 views

I have an issue where in a internal process based on an XFAPDF file needs to be converted into a standard PDF with attachments for eSign.  That part works great, but the attachments are all converting into PDF files and I need at least some of them to be maintained in their native format as this is a requirement of the deliverable to the partner.  I am using the invoke 'DDX' object to add the attachments, is there another method that I should be using?  Is there some setting that I am missing that would prevent the 'DDX' object from running the attachments through PDF Generator?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kosta_Prokopiu1

Yes to the steps with the exception of using the generatePDFOutput object so that the dynamic PDF has its state preserved.

 

Here is the DDX generated from script using the list generated from extracting the attachments:

<?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
<PDF result="outDoc">
<FileAttachments source="0">
<File filename="testattach.docx" mimetype="application/vnd.openxmlformats-officedocument.wordprocessingml.document"/>
<FilenameEncoding encoding="UTF-8"/>
</FileAttachments>
<FileAttachments source="1">
<File filename="exceltest.xls" mimetype="application/excel"/>
<FilenameEncoding encoding="UTF-8"/>
</FileAttachments>
<FileAttachments source="2">
<File filename="attachTest.txt" mimetype="text/plain"/>
<FilenameEncoding encoding="UTF-8"/>
</FileAttachments>
<PDF source="3"/>
</PDF>
</DDX>


Hi @jcaltrans 

the DDX per se is ok, you would not even need the mimetype. I used a static PDF and added an xlxs file and it showed up allright.

I have a feeling that your extraction of those attachments already goes wrong. 

I did a quick DDX only approach which extracts and adds. The file types remain what they were.

 

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

<FileAttachments result="attachmentInfo.xml" nameKeys="*" extract="true">
<PDF source="doc3.pdf"/>
<FilenameEncoding encoding="UTF-8"/>
</FileAttachments>

<PDF result="outDoc">
<FileAttachments source="doc3.pdf_attach.0000.0001">
<File filename="testattach.xlsx"/>
<FilenameEncoding encoding="UTF-8"/>
</FileAttachments>
<PDF source="3"/>
</PDF>

</DDX>

 

This pulls attachments from an XFA PDF and then I can use it to add to a static PDF.

The naming of the attachments source is generic. When you generate your DDX you can dynamically set it.

 

 

2 replies

Pulkit_Jain_
Adobe Employee
Adobe Employee
October 13, 2021

@jcaltrans 

Assembler service calls PDFG at the time of conversion, by default so not sure if its possible to bypass this step but you can explicitly specify the mimetype and encoding of the file attachment to ensure the filetype is intact after the conversion.

 

<PDF result="doc3.pdf">
<PDF source="doc1.pdf"/>
<PDF source="doc2.pdf"/>
<FileAttachments source="Testing.txt">
<File filename="Testing.txt" mimetype="text/plain"/>
<FilenameEncoding encoding="ISO-8859-1"/>
</FileAttachments>
</PDF>
</PDF>

Hope this helps!

Level 8
October 13, 2021

So how will the assembly work?

if there is a a combination of pdf and non pdf file types in the ddx?

jCaltransAuthor
Level 2
October 13, 2021

.

Mayank_Tiwari
Adobe Employee
Adobe Employee
October 14, 2021

Please refer to the sample PDF[0] in which JavaScript has been used to add multiple attachments of different types. The PDF file needs to be reader extended to work in Acrobat DC Reader.

 

[0]: https://drive.google.com/file/d/1j2aK65Mk7eF_Bi2PoHf9CWc4ir5c58we/view?usp=sharing