Generate Document Of Record (DOR) programmatically
This article illustrates the use of the com.adobe.aemds.guide.addon.dor.DoRService API
to generate Document of Record programmatically. Document of Record is a PDF version of the data captured in Adaptive Form.
com.adobe.aemds.guide.addon.dor.DoRService dorService = sling.getService(com.adobe.aemds.guide.addon.dor.DoRService.class);
com.adobe.aemds.guide.addon.dor.DoROptions dorOptions = new com.adobe.aemds.guide.addon.dor.DoROptions();
dorOptions.setData(dataXml);
dorOptions.setFormResource(resource);
java.util.Locale locale = new java.util.Locale("en");
dorOptions.setLocale(locale);
com.adobe.aemds.guide.addon.dor.DoRResult dorResult = dorService.render(dorOptions);
byte[] fileBytes = dorResult.getContent();
com.adobe.aemfd.docmanager.Document dorDocument = new com.adobe.aemfd.docmanager.Document(fileBytes);
To try this on your local system, please follow the following steps
Troubleshooting Tips
PDF isn’t displayed in new browser tab:
/content/usergenerated/content/aemformsenablement