Demonstrating Drag and Drop capability to create PDF using AEM Forms

PDFG stands for PDF Generation. This means you can convert a variety of file formats into PDF. The most common ones are Microsoft Office documents. PDFG has been part of AEM Forms since 6.1.

The assets associated with this article will allow you to drag and drop  MS office documents or JPG file into the drop zone of the HTML page. Once the document is dropped, it will invoke the PDFG service and convert the document into PDF and save it on the file system of AEM Server.

To install the demo assets, please perform the following steps

  1. Configure PDFG as mentioned in this document here.Please follow the appropriate documentation related to your AEM Forms version.
  2. Import and install the sample package using the package manager.
  3. Navigate to /apps/AemFormsSamples/components/createPDF/POST.jsp in your CRX
  4. Change the save location as per your preference(line 9)
  5. Save your changes.
  6. Open the html page for dragging and dropping files for conversion.
  7. Drop a word file or jpg into the drop zone.
  8. The input document will be converted into PDF and saved in the same location as specified in point 4.

The following code snippet shows the usage of PDFG service to convert files to PDF

com.adobe.pdfg.service.api.GeneratePDFService pdfService = sling.getService(com.adobe.pdfg.service.api.GeneratePDFService.class);
System.out.println("Got PDF Service");
java.util.Map map = pdfService.createPDF(uploadedDocument,fileName,"","Standard","No Security", null, null);


This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy