Free Support Forum - aspose.com

HTML to PDF failed for this document

i am having an issue to convert the document attached to pdf. Can you please help check to see if there is a chance to convert it to pdf?

thanks,
Kevin
155904851.zip (241.1 KB)

@ksheng

We have tested the scenario using the latest version of Aspose.Words for .NET 21.3 and have not found the shared issue. Please check the attached output PDF.
21.3.pdf (104.1 KB)

If you are not using Aspose.Words, please share the API name that you are using. We will investigate the issue and provide you more information on this issue.

Thank you @tahir.manzoor We’re using Java version of Aspose, not .NET version of it.

@ksheng

You can use Aspose.Words for Java to convert your HTML document to PDF. We have checked your other posts and noticed that you are using Aspose.PDF and Aspose.HTML. Please share the Aspose product name that you are using along with code example that you are using to reproduce the same issue at our end. We will then investigate the issue and provide you more information on it.

I think we’re using Aspose.Html to convert html to pdf.

Something like this: com.aspose.html.converters.Converter.convertMHTML( … …).

How do you use Aspose.Word to convert Html to Pdf? Do you have any sample code to share?

thanks,
Kevin

@ksheng

You can use following code example to convert HTML to PDF using Aspose.Words for Java.

Document doc = new Document(MyDir + "in.html");
doc.save(MyDir + "21.3.pdf", SaveFormat.PDF); 

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Please attach the output PDF file that shows the undesired behavior.
  • Please attach the expected output PDF file that shows the desired behavior.
  • Please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Thank you @tahir.manzoor I will check it out.

I am a little bit confused why Words is used to convert html file to pdf. Does words version have all functionality of Html module?

Thanks,
Kevin

@ksheng

Please note that Aspose.Words mimics the behavior of MS Word. If you convert your HTML document to PDF using MS Word, you will get the same output as generated by Aspose.Words.

As you are not using Aspose.Words, please share the requested resources here for testing. Thanks for your cooperation.

155904851.zip (241.1 KB)

This is the html file we failed to convert using Aspose.Html module to pdf.

Sorry I thought I already gave you the sample file.

Thanks,
Kevin

@tahir.manzoor One more question: do you think we can use Aspose.Words to convert all html files to pdf? If Aspose.Words works better, should I continue to use it for html to pdf conversion? What do you suggest?

Thanks/Kevin

@ksheng

We tested the scenario in our environment while using the latest version of the API i.e. Aspose.HTML for Java 21.3 and noticed that the API threw an Exception i.e. java.lang.StackOverflowError. Therefore, an issue as HTMLJAVA-773 has been logged in our issue tracking system. We will further look into its details and keep you informed about its rectification status. Please be patient and spare us some time.

We are sorry for the inconvenience.

We will get back to you with feedback regarding your above question.

@ksheng

Please note that Aspose.HTML is designed to work advanced HTML manipulation. However, You can also use Aspose.Words for Java to achieve your requirement.

In your case, Aspose.Words generates correct output. Please get 30 days temporary license and try the latest version of Aspose.Words for Java for you use cases.