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 the HTMl file. It has references to some images, but since i m able to attach only one file, i cant add those image files.