Free Support Forum - aspose.com

Empty PDF generated while converting HTMl to PDF using aspose words for java

Hi,

I am trying to convert an HTML to PDF. I am not getting any exception, but the pdf generated is empty.Can you please verify if the approach used is correct?

Code snippet.

String outputFileName;

public boolean convert(String fileName){

Document doc;

outputFileName = fileName+".pdf";

try {

doc=new Document(fileName, LoadFormat.HTML, null);

PdfOptions options = new PdfOptions();

options.setHeadingsOutlineLevels(3);

options.setExpandedOutlineLevels(1);

doc.saveToPdf(0, 1, outputFileName, options);

} catch (Exception e) {

System.out.println("Exception occurred while file conversion to pdf.");

e.printStackTrace();

}

return true;

}

I have attached a rar containing the HTML, the images it refers to and the empty PDF that it is generating.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I just answered this question here:

https://forum.aspose.com/t/73044

Best regards,