HI folks
we are trying to create a Servlet using Component and ask is to generate PDF from HTML File using following code but it is throwing an exception
com.adobe.pdfg.exception.ConversionException: ALC-PDG-080-019-Input file File.zip does not contain the index html file.
The HTML file I am using is basic one and converting to aemfd doc before passing to conversion method.
Pl help share inputs where things are wrong
AEM 6.5.8 OSGI AEM Forms on Linux
@component(service = Servlet.class, property = { Constants.SERVICE_DESCRIPTION + "=Testing Report Generation","sling.servlet.paths=" + "/bin/test-automation-report",})
public class HTMLtoPDFServlet extends SlingSafeMethodsServlet {
@Reference
GeneratePDFService pdfGenService ;
protected void doGet(final SlingHttpServletRequest request, final SlingHttpServletResponse response)
throws ServletException, IOException {
String inputFileName = "C://Users//manu.gupta//Downloads//testing//Test-Automation.html";
InputStream is = new FileInputStream(inputFileName);
Document returnDoc = new com.adobe.aemfd.docmanager.Document(is);
String securitySettings = "No Security";
String fileTypeSettings = "Standard";
com.adobe.pdfg.result.HtmlToPdfResult result;
try {
result = pdfGenService.htmlFileToPdf(returnDoc, securitySettings, fileTypeSettings, null, null);
//Get the newly created document
com.adobe.aemfd.docmanager.Document createdDocument = result.getCreatedDocument();
}
catch (ConversionException | InvalidParameterException | FileFormatNotSupportedException e) {
e.printStackTrace();
}
}
}
Solved! Go to Solution.
Views
Replies
Total Likes
closing this thread as I have moved the question to AEM forms community
Hi @manu-gupta ,
This is a working example. I used this a while ago and was able to convert to pdf successfully. - https://labs.tadigital.com/index.php/2018/04/23/generating-pdf-from-html-in-adobe-experience-manager...
HI Anish
I dont need a iTextRenderer or any other API solution. My ask is for AEM forms Services method on why it is not working.
closing this thread as I have moved the question to AEM forms community
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies