Expand my Community achievements bar.

OSGi equivalent method for JEE Output.transformPDF method? (Flatten XFA form)

Avatar

Level 2

Hi All

Coming from a LiveCycle background I've come to use the old "flattening" method often for converting an XFA form into a flat PDF. In LC the method was called transformPDF on the Output service.

I'm not seeing an equivalent method on the new OSGi version of the Output service. The OSGi output service only has various flavours of the generatedPDFOutput and generatePrintedOutput methods

Am I looking in the wrong place?

Regards,

Greg

3 Replies

Avatar

Level 2

Just found this statement on the Output Service docs page:

The generatePDFOutput operation can also accept an XFA-based PDF form as input and return a non-interactive version of the PDF form as output.

So it looks like the method was removed but the functionality is now inside the other method

Avatar

Level 2

Hi Greg,

   The use case of converting an XFA form to flat PDF can be achieved using generatePDFOutput operation.You can also find sample code at https://helpx.adobe.com/aem-forms/6-2/aem-document-services-programmatically.html#generatePDFOutput

Thanks

Nitin

Avatar

Level 2

Tx Nitin

Just to wrap up this thread, I'm posting my final solution. Key point is that you use the generatePDFOutput method, but pass in null as the XML data.

Here's a snippet:

    
    ... flattenXfaForm(File inXfa, String outputFolder)    { 

            ....
            Document doc=null;
            String xfaName = inXfa.getName().toString();
            PDFOutputOptions options = new PDFOutputOptions();   
            options.setContentRoot(inXfa.getParentFile().toString());
            doc=outputService.generatePDFOutput(xfaName, null, options);    

            ....

}    

 

Thanks for the quick assistance. Really appreciate

 

Greg