Free Support Forum - aspose.com

Urgent! HTML to PDF hanging

1.zip (1.4 KB)
Trying to convert the attached HTML to PDF hangs and sometimes take 3 - 4 mins to render. We are using the standard code

// load the file to be rendered
HTMLDocument htmdoc = new HTMLDocument(dir + “1.html”);
// render to PDF & XPS
HtmlRenderer renderer = new HtmlRenderer();
renderer.render(new PdfDevice(new PdfRenderingOptions(), dir + “output.pdf”), htmdoc);

@rgaurava

Could you please try using the below code snippet at your end with latest version of the API as we tested it in our environment and did not notice any issue:

com.aspose.html.HTMLDocument htmlDocument = new com.aspose.html.HTMLDocument(dataDir + "1.html");
// Output file path
String outputPDF = dataDir + "output.pdf";
// Convert HTML to PDF
com.aspose.html.converters.Converter.convertHTML(htmlDocument, options, outputPDF);

com.aspose.html.HTMLDocument htmlDocument = new com.aspose.html.HTMLDocument("./1.html");
// Output file path
String outputPDF = “./output.pdf”;

println new Date()
com.aspose.html.saving.PdfSaveOptions pdfSaveOptions = new com.aspose.html.saving.PdfSaveOptions()
// Convert HTML to PDF
com.aspose.html.converters.Converter.convertHTML(htmlDocument, pdfSaveOptions, outputPDF);
println new Date()

Its taking more than 3 mins to execute to complete

com.aspose.html.HTMLDocument htmlDocument = new com.aspose.html.HTMLDocument("./1.html");

and the logo and the barcode is still not getting into the generated PDF.

Mon May 31 14:06:23 PDT 2021
Mon May 31 14:08:05 PDT 2021
Mon May 31 14:08:06 PDT 2021

@rgaurava

We have tested the scenario in our environment and noticed that the API took ~100s while converting your HTML into PDF. Regarding missing logo and barcode, we were able to notice it and logged it as HTMLJAVA-806 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.