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.

Tue Mar 21, 2023 6:49 am

Hi,

I am trying to convert html to pdf using plugin with proper way,Its work fine locally but don't know on server it does'nt give any error while convert html to pdf but while load or fetch genrated file it gives error file not found

As i look in to method found that .pdf file is not generating also not giving error for conversion

here is my source code

string tempPath = Path.Combine(_appFolders.TempFilePath, "test.pdf");

HtmlConverter.PluginPath = _appFolders.SpirePlugin;
PdfMargins margin = new PdfMargins();
margin.Top = 60;
margin.Bottom = 90;

string input = @"<strong>This is a test for converting HTML string to PDF </strong>
<ul><li>Spire.PDF supports to convert HTML in URL into PDF</li>
<li>Spire.PDF supports to convert HTML string into PDF</li>
<li>With the new plugin</li></ul>";
try
{
HtmlConverter.Convert(input, tempPath, true, 100000, new SizeF(612, 792), margin, LoadHtmlType.SourceCode);
//here its not give any error and pass suceesfully but not generating pdf file,i also check for folder permision and give full access for that
}
catch (Exception ex)
{
throw new UserFriendlyException("Html to pdf conversion fail " + ex.Message);
}

byte[] bytes = System.IO.File.ReadAllBytes(tempPath); //got error here that file not found because not generating



i used 64bit plugin for conversion as my server is 64bit,it was working before but suddnely what happen it does'nt work on server but work locally

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Wed Mar 22, 2023 2:11 am

Hi,

Thank you for your inquiry.
To help us quickly reproduce your issue and give you an effective solution, could you please provide us with the following information?
1) The version of our product you are using, such as Spire.Pdf for .NET 9.3.4.
2) Your server environment, such as OS info (E.g. Windows Server2016, 64-bit) and region setting (E.g. China, Chinese).
3) Your application type, such as MVC app (. Net Framework 4.5)
4) Did you get plugins from https://www.e-iceblue.com/downloads/plugins/plugins-windows-x64.zip?

Thank you for your assistance in advance.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Mar 22, 2023 9:41 am

Hi

Here i inform you that i am using free version of spire pdf and its work fine from last 6 month on server but suddenly all application with spire pdf stop working for conversion of html to pdf on server

Please find below information

1) The version of our product you are using, such as Spire.Pdf for .NET 9.3.4. - Spire PDF 8.6.0
2) Your server environment, such as OS info (E.g. Windows Server2016, 64-bit) and region setting (E.g. China, Chinese). - 86 bit windows Server
3) Your application type, such as MVC app (. Net Framework 4.5) : MVC,Asp.net boilerplat, .NET 6
4) Did you get plugins from /downloads/plugins/plugins-windows-x64.zip : Yes


Hope this helps you

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Thu Mar 23, 2023 9:23 am

Hi,

Thanks for sharing further information.

You mentioned that it worked fine from last 6 month but suddenly it is not working now on same server. Have you made any changes to the server or application pool configuration during this time?

In your previous message, you mentioned that the issue occurred on a 64-bit server, but in your latest message, you mentioned an 86-bit server. Did you switch to a 32-bit server?

I have successfully generated PDF files using Spire PDF 8.6.0 and your code on Windows Server 2016 Datacenter, 64-bit.

Could you please provide more information about your server system version, such as Windows Server 2016, 64-bit ? Also, please provide information about your application pool configuration. I will investigate further with the same environment as yours.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Mon Mar 27, 2023 1:28 pm

Hi,

We got below feedback from our hosting provider for our site goatsign.dk where html to pdf functionality is not working
OS (hosting) is a Windows Core Server (and not a full Windows Server and IIS)– so if your pdf plugin is using any of the graphical elements from Windows that might be the reason for this to fails.


Our server detail

Server : Windows Core Server(64bit)
Spire plugin : 64 bit

Is there any extra configuration required for this?

Also we have attached server log detail said file is not found means file is not generated in folder using plugin


Thanks

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Tue Mar 28, 2023 2:50 am

Hi,

Thanks for your response.

The HTML to PDF conversion feature is implemented using a QT plugin. I suspect the issue you are experiencing is due to your system being Windows Core Server (and not a full Windows Server and IIS), which causes QT to fail.

Using QT Plugin on Windows Core Server requires manually installing and configuring additional dependencies or libraries because it lacks some necessary components. Specifically, you need to:
1. Install the Visual C++ runtime library.
2. Enable the Desktop Experience feature in Windows to support the GUI of QT programs.
3. Install QT and its related plugins, and add their path to the system PATH variable.

Please note that this configuration is much more difficult than configuring it on a full Windows Server and IIS and may be subject to more restrictions and security risks.

If your environment can successfully use and run QT plugins, your problem should be resolved. Please note that the plugin available for download here: https://www.e-iceblue.com/downloads/plu ... ws-x64.zip depends on QT version 5.14.2.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Tue Mar 28, 2023 10:56 am

Hi

Thanks for your response,


I have another question, Is there any way that we can convert html to pdf without QT plugin in latest spire pdf nuget?

I know there is a way but in latest version of spire pdf LoadFromHTML and PdfHtmlLayoutFormat was removed so any another option for that?

For your refference i am using 64bit .Net Core application for that

Thanks in advance

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Wed Mar 29, 2023 7:37 am

Hi,

Thank you for your inquiry regarding the conversion of HTML to PDF in .NET Core projects. Our Spire.PDF relies on the Qt plugin for this conversion process. There are no alternative solutions available currently. Thanks for your understanding.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 999
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.PDF