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.

Thu Sep 21, 2023 1:21 pm

Hi Team,
Can please explain the exact steps that how can i convert a html file to pdf file using dotnet 6.0 in the operating system ubuntu 20.04.
i need the clear steps without fail, Please let me know

tegav_pandey
 
Posts: 20
Joined: Thu Sep 21, 2023 1:15 pm

Fri Sep 22, 2023 7:41 am

Hi,

Thanks for your inquiry.
You can refer to the following link:
https://www.e-iceblue.com/Tutorials/Spi ... rself.html.
If you have any other questions or concerns, please feel free to contact us anytime.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Mon Sep 25, 2023 9:27 am

Hi Team,

I have tried the same but no luck . unable to generate converted pdf document. so please share the latest one ,because their may be any sample code changes are their ??

sample code:-

using System.IO;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
using Spire.Pdf.Graphics;
using System;
using Spire.Pdf;
using Spire.Pdf.Widget;

namespace ConvertHtmlStringToPdfWithPlugin
{
class Program
{
static void Main(string[] args)
{
//Get the HTML string from a .html file
string htmlString = File.ReadAllText(@"/root/............/invoice.html");
// Console.WriteLine(htmlString);
string outputPath = "/root/................../sample.pdf";
//Specify the plugin path
string pluginPath = "/root/................plugins";
//Set plugin path
HtmlConverter.PluginPath = pluginPath;
try
{
//Convert HTML string to PDF
HtmlConverter.Convert(htmlString, outputPath, true, 100000, new Size(1080, 1000), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);

Console.WriteLine("HTML to PDF conversion succeeded.");
}
catch (Exception ex)
{
Console.WriteLine("HTML to PDF conversion failed: " + ex.Message);
}
}
}
}

tegav_pandey
 
Posts: 20
Joined: Thu Sep 21, 2023 1:15 pm

Tue Sep 26, 2023 8:50 am

Hi

Thank you for your feedback.
Firstly, your code need to be modified as shown in the figure below:
C643AE5B-E4B2-45db-9C35-10B1DFC554EE.png

Secondly, please note what exceptions were encountered in this code? Has an error been thrown during the execution process, or has there been no exception during the execution process, but no result document was generated at the specified path. If this is the second case, please check if there are any result documents in the temporary folder of Ubuntu(/tmp).
Finally, you need to check if Html2Pdf and libexec/QtWebEngineProcess in the plugins folder have executable permissions for the current user. In addition, please enter the plugins directory and execute the ldd Html2Pdf command to check for any missing dependencies. If they are missing, please install the corresponding dependencies.

Sincerely
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Fri Sep 29, 2023 1:24 pm

tried the same but no luck , can you please provide updated , latest sample code and its dependence's like pluigns

tegav_pandey
 
Posts: 20
Joined: Thu Sep 21, 2023 1:15 pm

Mon Oct 02, 2023 5:32 am

Hello,

Thank you for your feedback.
Due to our Mid Autumn Festival and National Day holidays from September 29th to October 6th, I will provide you with a testing project containing plugins after returning to the office on October 7th. Thank you for your understanding.

Best regards,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1651
Joined: Wed Apr 07, 2021 2:50 am

Tue Oct 03, 2023 7:16 am

Hello Team,
Thanks for your update, I will be waiting for your further updates regarding the sample test code and etc..

tegav_pandey
 
Posts: 20
Joined: Thu Sep 21, 2023 1:15 pm

Wed Oct 04, 2023 12:48 pm

Hello,

There are any updates, I'll inform you in time.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 984
Joined: Tue Mar 08, 2022 2:02 am

Sun Oct 08, 2023 8:54 am

Hi,

Thank you for your patience.
I have uploaded a complete demo to our server. You can download through the following link and have a test. I'm sorry for the inconvenience caused to you during this period.
Download link:https://www.e-iceblue.com/downloads/demo/ConsoleApp14.zip

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Mon Oct 09, 2023 1:22 pm

Hi Team,

We are working in ubuntu env with dotnet sdk 5.0 , Can you please the sample code for the same. Also share the exact steps like any pre-requites to be installed on same project. It is better if you share the exact sample code and any packages need to be installed to run the project.

tegav_pandey
 
Posts: 20
Joined: Thu Sep 21, 2023 1:15 pm

Tue Oct 10, 2023 1:38 am

Hi,

Thank you for your feedback.
I have uploaded a complete demo with dotnet sdk5 to our server. You can download through the following link and have a test. I'm sorry for the inconvenience caused to you during this period.
Download link:https://www.e-iceblue.com/downloads/demo/ConsoleApp15.zip

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Tue Oct 10, 2023 7:12 am

Hi Team,

I have tried the same but no luck , with the shared sample project. But Iam Unable to do conversation that means not able to get output file..
Sharing more details:-
Os: - ubuntu 20.04
Dotnet version: -5.0.408
Sample code:-

using Spire.Pdf.Graphics;
using Spire.Pdf.HtmlConverter.Qt;
using System;
using System.Drawing;

namespace HtmlToPdfConverter
{
internal class Program
{
static void Main(string[] args)
{
string url = @"/root/HtmlToPdfConverter/data/1.html";

//Specify the output file path
string fileName = @"/root/HtmlToPdfConverter/output/urltopdf.pdf";

//Specify plugin path
//Please replace the corresponding plugin according to your system environment
string pluginPath = @"/root/HtmlToPdfConverter/Qt/linux-64";

//Set plugin path
HtmlConverter.PluginPath = pluginPath;

//Convert URL to PDF
HtmlConverter.Convert(url, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0));
}
}
}

tegav_pandey
 
Posts: 20
Joined: Thu Sep 21, 2023 1:15 pm

Wed Oct 11, 2023 2:20 am

Hi,

Thanks for your inquiry.
Firstly, you need to check the Html2Pdf and libexec/QtWebEngineProcess files in the plugin linux-64 folder, as well as the ConsoleApp14.dll and ConsoleApp14 or ConsoleApp14.exe files in the ConsoleApp14\bin\Release\net5.0 path to check if they have executable permissions for the current user. Secondly, if your Ubuntu is a non desktop operating system, please refer to the online documentation for installing xvfb. Finally, test again.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Wed Oct 11, 2023 2:22 pm

Hi Team,

a) Sample application is working on dotnet 5.0 version with ubuntu 20.0 but when iam trying do same with dotnet 6.0 it getting as error below

Unhandled exception. System.InvalidOperationException: The conversion provider fail:Fail to load /root/HtmlToPdf/Qt/linux-64/libHTMLConverter.so : error
For more help, please visit below website.
https://www.e-iceblue.com/Tutorials/Spi ... lugin.html

b) For this i have downloaded latest plugin which you have suggested then iam getting another issue as below

QCoreApplication::applicationDirPath: Please instantiate the QApplication object first.

My question why the latest plugins that u suggested is not working ...

c) Conclusion :-

Working fine with env
os : - ubuntu 20.04
dotnet version : - 5.0
plugins : - linux-64/

Not working with below env
os : - ubuntu 20.04
dotnet version : - 6.0
plugins : - https://www.e-iceblue.com/downloads/plu ... x64.tar.gz

d) Sample code with which it is not working


using Spire.Pdf.Graphics;
using Spire.Pdf.HtmlConverter.Qt;
using System;
using System.Drawing;

namespace HtmlToPdf
{
internal class Program
{
static void Main(string[] args)
{
string url = @"/var/www/HtmlToPdf/data/1.html";

//Specify the output file path
string fileName = @"/var/www/HtmlToPdf/output/urltopdf.pdf";

//Specify plugin path
//Please replace the corresponding plugin according to your system environment
string pluginPath = @"/var/www/HtmlToPdf/Qt/plugins";

//Set plugin path
HtmlConverter.PluginPath = pluginPath;

//Convert URL to PDF
HtmlConverter.Convert(url, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0));
}
}
}


Please we need the resolution for this issue ASAP .

tegav_pandey
 
Posts: 20
Joined: Thu Sep 21, 2023 1:15 pm

Thu Oct 12, 2023 5:56 am

Hi Team,

Can we get any update on the above query....

tegav_pandey
 
Posts: 20
Joined: Thu Sep 21, 2023 1:15 pm

Return to Spire.PDF