Highlighted

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

Avatar

Avatar

GregFullard

Avatar

GregFullard

GregFullard

03-11-2016

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

Replies

Highlighted

Avatar

Avatar

GregFullard

Avatar

GregFullard

GregFullard

03-11-2016

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

Highlighted

Avatar

Avatar

nitinn18425437

Avatar

nitinn18425437

nitinn18425437

03-11-2016

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

Highlighted

Avatar

Avatar

GregFullard

Avatar

GregFullard

GregFullard

03-11-2016

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