Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Nov 06, 2019 1:10 pm

I need to convert a HTML file to PDF in my web service, but I cannot get it to work.

I tried the method provided at /Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Convert-HTML-to-PDF-Customize-HTML-to-PDF-Conversion-by-Yourself.html, and it works great on local machine. When run on a server it throws this exception: System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.

I also tried the method provided at /Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Convert-HTML-to-PDF-with-New-Plugin.html. but I cannot get it to work even on the local machine. I get an exception asking me to make sure the plugins-folder is in the same place as the Spire.PDF.dll - and it is.

Any help? I'm running Spire.Office 4.8.3 (hotfix)

PRObank
 
Posts: 5
Joined: Tue Aug 20, 2019 5:31 am

Thu Nov 07, 2019 11:05 am

Hi,

Thanks for your inquiry.
Firstly, I suggest you use the latest Spire.Office Platinum (DLL Only) Version:4.10.0.

If the issue still happens after trying, for the first issue, to help us investigate it accurately, please offer us the following information.
1. A runnable project which could reproduce your issue directly.
2. The OS and Region information, e.g. Windows server 2012, 64bit, China/Chinese.
You could upload them here or send us(support@e-iceblue.com) via email.

For the issue with new plugin, please make sure you have put the correct plugin in the correct place. And you could try the following method to specify the Plugin Path directly.

Code: Select all
Spire.Pdf.HtmlConverter.Qt.HtmlConverter.PluginPath = @"……\bin\Debug\plugins\";


Best wishes,
Amber
E-iceblue
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Mon Nov 11, 2019 1:55 pm

Hi,

Thank you for your response.

I updated to 4.10.0, but the method from /Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Convert-HTML-to-PDF-Customize-HTML-to-PDF-Conversion-by-Yourself.html still gives me the same error when trying to run on Azure: "System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component."

I managed to get the plugin to work on Azure using the Spire.Pdf.HtmlConverter.Qt.HtmlConverter.PluginPath. However, the performance is very poor. It can take me up to 15 seconds to convert a HTML file to a PDF file with 7 pages on Azure while running in P1V2 (without coming near my CPU or memory caps).

Earlier I used Spire.Doc to convert HTML to images, but that didn't render pages that use Javascript correctly.

PRObank
 
Posts: 5
Joined: Tue Aug 20, 2019 5:31 am

Tue Nov 12, 2019 9:57 am

Hi,

Thanks for your reply.
1. About the exception issue, please offer us a runnable project which could reproduce your issue directly for further investigation.

2. About the slow speed issue with the plugin method, please offer us your HTML file and the complete code you were using for further investigation.

3. As for the incorrect page while converting Html file to image with Spire.Doc, note our Spire.Doc follows the rules of MS Word. If MS Word could render your HTML file correctly, then Spire could also do that. Please offer us your input Html file for investigation.

You could upload them here or send us(support@e-iceblue.com) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Wed Nov 13, 2019 12:30 pm

Hi again,

1. & 2.
SpireTest.zip

This archive contains a solution that can be used to test the HTML to PDF conversion. To run it the Spire.Office DLL's need to be added into a folder SpireHtmlConversionTest\Spire\ and the contents of the plugins folder from /Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Convert-HTML-to-PDF-with-New-Plugin.html needs to be added into a folder SpireHtmlConversionTest\Plugins\. I couldn't upload a solution with the DLL's already in place because the archive was too large for your Forum to allow the upload. The folder SpireHtmlConversionTest\ also contains the HTML files I've been trying to convert.

3.
This is how part of the HTML file (that can be found inside the aforementioned archive) looks on Word 2016:
word 2016 conversion.png

This is how the same part looks when I convert it with Spire.Doc:
Spire Doc conversion.png


It's the missing checboxes etc. that present a problem.

PRObank
 
Posts: 5
Joined: Tue Aug 20, 2019 5:31 am

Thu Nov 14, 2019 12:21 pm

Hi,

Thanks for your information.
For 1 & 2 issue, I am still investigating them. Please share us little more time, I will finish the test ASAP. Once there is any progress, we will inform you. Sorry for the inconvenience caused.
For the 3rd issue, I tested your file and did notice the issue you mentioned. I have logged it into our bug tracking system. Once there is any progress, we will inform you. Sorry for the inconvenience caused.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Fri Nov 15, 2019 12:07 pm

Hi,

Hope you are doing well.
1. For the first issue, after further investigation, I didn't reproduce it on my side. There won't be the System.Runtime.InteropServices.COMException exception when I run it on Azure. Please try to run your project on another computer to check if the issue still happens. Meanwhile I will make a further investigate about it.

2. About the slow speed of the conversion, I have noticed the issue and posted it to our Dev team. Once there is any progress, we will inform you. Sorry for the inconvenience caused.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Tue Nov 19, 2019 3:34 am

Hi,

Hope you are doing well.
For the first issue, after further investigation, I have reproduced it and logged it into our bug tracking system. Once there is any progress, we will inform you.
Sorry for the inconvenience caused.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Thu Nov 28, 2019 11:54 am

Hi,

Hope you are doing well.

About the exception issue (System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.) while converting Html file to Pdf file using LoadFromHtml method on Azure, after further investigation, we found that there is a deep dependency on browser while deploying the project on Azure. The LoadFromHtml method is dependent on the IE kernel. However, the IE kernel can't parse the method correctly, which causes the exception. I'm afraid we couldn't fix it. Hope you could understand.

Our Dev team is investigating the slow speed issue while converting Html file to Pdf file with new plugin on Azure. Once there is any progress, we will inform you ASAP. Sorry for the inconvenience caused.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Return to Spire.PDF