We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to convert from html to pdf

Hi i am trying to use your product to convert from html to pdf,

but always giving me errors like:

  • com.aspose.html.internal.ms.System.NotSupportedException: getContentAreaBPD() called when it should have been overridden

  • Exception in thread “main” java.lang.ClassCastException: com.aspose.pdf.internal.html.dom.svg.SVGElement incompatible with com.aspose.pdf.internal.html.dom.svg.SVGGElement

and used below sample code :
String dir = “/rootPath”;
HtmlLoadOptions htmloptions = new HtmlLoadOptions();
Document doc = new Document(dir + “test.html”, htmloptions);
doc.save(dir + “aspose.pdf”);


HTMLDocument htmdoc = new HTMLDocument(dir + “tempHTML.html”);
// render to PDF & XPS
HtmlRenderer renderer = new HtmlRenderer();
renderer.render(new PdfDevice(new PdfRenderingOptions(), dir + “output.pdf”), htmdoc);

can u help me, which jar version to use and working sample code, and if i have css files and images needed how to link them



It seems like you are trying both Aspose.PDF and Aspose.HTML. Would you kindly share your sample HTML file in .zip format with us so that we can test the scenario in our environment and address it accordingly?

Also, please check the following useful links in order to convert HTML to PDF:

Hey, if you want to convert the HTML to PDF by the given manual process:

  1. On a Windows computer, open an HTML web page in Internet Explorer, Google Chrome, or Firefox. …
  2. Click the “ Convert to PDF ” button in the Adobe PDF toolbar to start the PDF conversion .
  3. Enter a file name and save your new PDF file in the desired location.

@asad.ali No i checked them separately and every one gave different error, html file is private , i will check if i can give you sample from it


Sure, please take your time to gather the sample file and provide it to us. We will test the scenario in our environment and address it accordingly.