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

Free Support Forum - aspose.com

Convert HTML to PDF Aspose.Pdf 9.1 Excepton

We are currently using the version 9.1 to convert HTML to PDF. However there is an error in which we couldn’t understand because it is an error thrown by aspose itself.


Here’s the code:
// Specify the The base path/url for the html file which serves as images database
String basePath = “C:/Users/Documents/AsposeTest”;
com.aspose.pdf.HtmlLoadOptions htmloptions = new
com.aspose.pdf.HtmlLoadOptions(basePath);
// use the new conversion engine
htmloptions.setUseNewConversionEngine(true);
// load HTML file
com.aspose.pdf.Document doc = new
com.aspose.pdf.Document(basePath+“NewFile.html”, htmloptions);
// Save HTML file
doc.save(“Web+URL_output.pdf”);

Actually, this is almost exactly the copy and paste code mentioned on this website on how to convert HTML file to PDF however and Exception error is thrown. Here’s the error:

Exception in thread “main” class com.aspose.pdf.internal.hv.g: Value cannot be null.
Parameter name: stream
com.aspose.pdf.internal.ii.am.b(Unknown Source)
com.aspose.pdf.internal.ii.am.(Unknown Source)
com.aspose.pdf.internal.ii.am.(Unknown Source)
com.aspose.pdf.bn.a(Unknown Source)
com.aspose.pdf.ADocument.a(Unknown Source)
com.aspose.pdf.ADocument.(Unknown Source)
com.aspose.pdf.Document.(Unknown Source)
com.aspose.main.AsposePdfTest.main(AsposePdfTest.java:22)
at com.aspose.pdf.internal.ii.am.b(Unknown Source)
at com.aspose.pdf.internal.ii.am.(Unknown Source)
at com.aspose.pdf.internal.ii.am.(Unknown Source)
at com.aspose.pdf.bn.a(Unknown Source)
at com.aspose.pdf.ADocument.a(Unknown Source)
at com.aspose.pdf.ADocument.(Unknown Source)
at com.aspose.pdf.Document.(Unknown Source)
at com.aspose.main.AsposePdfTest.main(AsposePdfTest.java:22)

Can you please let us know what seems to be the problem? We are considering purchasing Aspose. Please reply to us the soonest. Thank you.

Hi Paul,


Thanks for your inquiry. We will appreciate if you please share your sample document and working environment details here, we will test the scenario and will provide you more information accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Thanks for the reply.

We are currently using Spring Tool Suite Eclipse as our IDE. We have downloaded and added aspose.pdf-jdk-16 in the project of our library. The code above is the only source code that we have on the project. We have our jdk version on 1.7.5. Windows vista as our
OS

Hi Paul,


Thanks for your feedback. I am preparing the required platform to simulate the environment as of yours. As soon as everything is setup, I will test the issue on my end and will post my results here for your kind reference.


Meanwhile, please confirm you are getting this exception with or without Aspose license implementation and please also share a sample problematic HTML document. It would help us in the investigation.

Thank you for your patience and understanding.<o:p></o:p>


Best Regards,

Sure. The HTML is fairly simple


<meta charset="ISO-8859-1">
TITLE SAMPLE
HELLO WORLD SAMPLE



I am getting this exception without the license. Thank you.

Hi Paul,


Thanks for your feedback. You may request a 30 days temporary license for evaluation of Aspose.Pdf for Java without any limitation. Please test the subjected scenario with license and share the results.

Moreover, Please also check following documentation link for applying license file.


Best Regards,

Hi Tilal,


Are you saying that you can’t help me because I don’t have the license yet? Or does this mean that it cannot work without the license itself?

Hi Paul,


First of all please accept our humble apologies for the delay and confusion.

Please note that we love to assist our customers and answer every query related to our API’s whether the customer has license or not. The forum and live chat support is free.

Now concerning to your issue, please note that when using Aspose.Pdf for Java to convert HTML to PDF format in trial mode (without license), the resultant PDF is appearing as blank. However when using a valid license, the HTML is properly being converted. For your reference, I have also attached the resultant PDF generated over my end. Please take a look. In case of any further query, please feel free to contact.

We are sorry for your inconvenience.


PS, in earlier post by Tilal, he has recommend to get a 30 days temporary license to test the API without any limitations.