Hi everyone,
I am encountering a persistent OperationException [AEM-ASM-S00-002] when trying to flatten a PDF using the AssemblerService.
The Context:
I am generating a PDF using the PrintChannel.render() method (part of AEM Interactive Communications).
I take the resulting InputStream, convert it to a com.adobe.aemfd.docmanager.Document, and attempt to flatten it using the AssemblerService.
The invoke() method fails immediately with the generic DDX execution error.
<?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
<PDF result="flattenedPDF.pdf">
<PDF source="unflattenedPDF.pdf" flatten="true"/>
</PDF>
</DDX>
is the DDX I am using.
The Java Implementation: I am passing the document in a Map with a key that matches the DDX source:
// initialPdfBytes comes from PrintDocument.getInputStream()
Document unflattenedPdfDocument = new Document(new ByteArrayInputStream(initialPdfBytes));
Map<String, Object> inputs = new HashMap<>();
inputs.put("unflattenedPDF.pdf", unflattenedPdfDocument);
// This line throws the OperationException
jobResult = assemblerService.invoke(ddxDocument, inputs, assemblerOptionSpec);
The Stack Trace:
com.adobe.fd.assembler.client.OperationException: AEM-ASM-S00-002: Failed to execute the DDX - error messages provided.
at com.adobe.fd.assembler.service.impl.AssemblerServiceImpl.execute(AssemblerServiceImpl.java:822)
at com.adobe.fd.assembler.service.impl.AssemblerServiceImpl.invoke(AssemblerServiceImpl.java:234)
at com.yourcompany.project.util.GeneratePDFBytes.generatePDF(GeneratePDFBytes.java:125)
Any guidance or troubleshooting tips would be greatly appreciated.
Thanks in Advance
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @KavyaM1,
As per the DDX specification, the tag only specifies that XFA-based forms in the pages within the scope of the parent element be flattened. If the document does not contain XFA-based forms, it is unmodified. I dont believe the PDF that you are using is a XFA based document and hence the it is not working.
In addition to that, I could also see that the DDX you have used is not properly defined. Please find below the standard structure of a DDX.
<DDX xmlns="http://ns.adobe.com/DDX/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
<PDF result="Out1.pdf">
<PDF source="Doc1"/>
<PDF source="Doc2"/>
<NoXFA/>
</PDF>
</DDX>
Thanks
Pranay
Views
Replies
Total Likes
@KavyaM1 , can you share the sample pdf, and aem form version on which you are ?
Views
Replies
Total Likes
AEM Version: 6.5
I cannot share the PDF due to corporate data privacy policies. However, the document is the direct output of the PrintChannel.render() service
The AssemblerService.invoke() method throws an OperationException immediately upon execution.
Because the exception happens during the invoke call, I am unable to retrieve the JobResult or the JobLog to see the specific DDX error.
I have already tried adding the <NoXFA/> tag to the DDX, but the service still fails with the same error.
Views
Replies
Total Likes
Hi @KavyaM1,
As per the DDX specification, the tag only specifies that XFA-based forms in the pages within the scope of the parent element be flattened. If the document does not contain XFA-based forms, it is unmodified. I dont believe the PDF that you are using is a XFA based document and hence the it is not working.
In addition to that, I could also see that the DDX you have used is not properly defined. Please find below the standard structure of a DDX.
<DDX xmlns="http://ns.adobe.com/DDX/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
<PDF result="Out1.pdf">
<PDF source="Doc1"/>
<PDF source="Doc2"/>
<NoXFA/>
</PDF>
</DDX>
Thanks
Pranay
Views
Replies
Total Likes
Views
Likes
Replies