How to render PDF/A | Community
Skip to main content
AlexanderWillet
Adobe Employee
Adobe Employee
October 16, 2015
Solved

How to render PDF/A

  • October 16, 2015
  • 15 replies
  • 9328 views

Hi,

we would like to render a PDF/A out of an xdp template and some xml formdata. The OutputService.generatePDFOutput(xdp, xml-data, PDFOutputOptions) should be the right api to do this. The specific adjustments to get a PDF/A should be handed over within the PDFOutputOptions object I assume. 

The former LiveCycle api had a similar service but the paramerters are different. It supported settings like:

  • TransformationFormat.PDFA
  • setPDFARevisionNumber(PDFARevisionNumber.Revision_1)
  • setPDFAConformance(PDFAConformance.B) 

In the PDFOutputOptions I'm missing settings like that.

Can someone provide me with a code snippet or point me to some sample that does PDF/A rendering with the new AEM6 forms?

Thank's for any help on this!

Alex

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 nitinn18425437

Hi Alex,

In order to create PDF/A document you need to render regular PDF using OutputService.generatePDFOutput(xdp,xml-data,PDFOutputOptions) and convert resulting PDF to PDF/A using AssemblerService.toPDFA method.

http://helpx.adobe.com/aem-forms/6/javadocs/com/adobe/fd/assembler/service/AssemblerService.html#toPDFA(com.adobe.aemfd.docmanager.Document, com.adobe.fd.assembler.client.PDFAConversionOptionSpec)

 

Thanks

Nitin

15 replies

sebastian_wilhe
Level 2
October 16, 2015

Rename to xdp

Level 2
October 16, 2015

Hi Alex, Sebastian,

I think the issue is that the xmp file resides on file system and in the code 

Document schemaDoc = new Document(schemaPath);

schemeDoc is being created using string argument constructor. This assumes the files is in repository. In order to specify a file which resides on files system use constructor with java.io.File argument as in

Document schemaDoc = new Document(new java.io.File(schemaPath));

 

Thanks

Nitin

sebastian_wilhe
Level 2
October 16, 2015

And another invalid file type...

Rename to xmp

sebastian_wilhe
Level 2
October 16, 2015

Hi Nitin,

Perfect! This is the solution to the problem!

Now I get valid PDF/A-1b.

thanks for the help!

 

Regards,

Sebastian

sebastian_wilhe
Level 2
October 16, 2015

Here is the final example code, after all corrections:

/* * converts existing PDF file to PDF/A-1b format */ private Document convertToPDFA(Document inputPDF, String xmpFileName) { try { PDFAConversionOptionSpec conversionSpec = new  PDFAConversionOptionSpec(); conversionSpec.setLogLevel("FINE"); conversionSpec.setResultLevel(PDFAConversionOptionSpec.ResultLevel.DETAILED); conversionSpec.setCompliance(PDFAConversionOptionSpec.Compliance.PDFA_1B); conversionSpec.setSignatures(PDFAConversionOptionSpec.Signatures.ARCHIVE_AS_NEEDED); conversionSpec.setColorSpace(PDFAConversionOptionSpec.ColorSpace.S_RGB); if (xmpFileName != null) { // Add PDFA Converter Schema String schemaPath = xmpFileName; List<Document> metadataSchemaExtensions = new ArrayList<Document>(); Document schemaDoc = new Document(new File(schemaPath)); metadataSchemaExtensions.add(schemaDoc); conversionSpec.setMetadataSchemaExtensions(metadataSchemaExtensions); //conversionSpec.setRemoveInvalidXMPProperties(true); } PDFAConversionResult pdfaResult = assemblerService.toPDFA(inputPDF, conversionSpec); Document pdfa = (pdfaResult != null) ? pdfaResult.getPDFADocument() : null; return pdfa; } catch (ConversionException e) { RenderServlet.LOG.debug(e.getClass().getName() + ": " + e.getLocalizedMessage()); e.printStackTrace(); this.logStackTrace(e); } return null; }