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.

Sat Dec 02, 2023 10:23 pm

I am attempting to get a console proof of concept app working. We are on .net 8.0, and I have the latest version Spire.Officefor.NETStandard (8.11.0) installed. I have also downloaded the qt plug in as recommended in the documentation, and have it extracted a plugins folder on my home directory.

When I use the following code:

Code: Select all
string htmlString = "<html><body><h1>Hello, World!</h1></body></html>";
string pluginPath = "/home/[UserName]/source/prototypes/dotnet/plugins/plugins";
string fileName = "HelloWorld.pdf";

var pdfStream = new MemoryStream();
HtmlConverter.PluginPath = pluginPath;
HtmlConverter.Convert(htmlString, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);

// Convert HTML to PDF
// HtmlConverter.Convert(htmlString, pdfStream, LoadHtmlType.SourceCode);

// string filePath = "output.pdf";
// File.WriteAllBytes(filePath, pdfStream.ToArray());

Console.WriteLine("PDF file created successfully.");


I get errors about being unable to load the shared library libdl.

HTMLConverter: System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:


What am I doing wrong here? I am running this on ubuntu, with the intention of deploying a similar solution to a linux container in Azure.

garethsuarez
 
Posts: 4
Joined: Tue Nov 28, 2023 5:18 am

Mon Dec 04, 2023 7:03 am

Hi,

Thank you for your inquiry.
This error prompt is because a shared library named "libdl" cannot be found while running the program. Make sure you have installed the "libdl" library. On Ubuntu systems, the following commands can be used to install:
Code: Select all
sudo apt-get install libc6-dev

If the issue still exists, please find and refer to the relevant link online on how to install the libdl library and offer your ubuntu version to help us do further investigation. Thank you in advance.

Sincerely,
Ula
E-iceblue support team
User avatar

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

Mon Dec 04, 2023 9:10 pm

I have the libc6-dev installed, however, the libdl.so file doesn't appear to be copying to the linux-x64 directory in my bin on building my application, so it cannot be found there.

garethsuarez
 
Posts: 4
Joined: Tue Nov 28, 2023 5:18 am

Tue Dec 05, 2023 3:01 am

Hi,

Thanks for your more inquiry.
Please follow the steps below to do check:
1)Firstly, If your Ubuntu is a non desktop operating system, please use the following command to install:
Code: Select all
sudo apt-get install xvfb

2)Secondly,you need to locate the Html2Pdf and libexec/QtWebEngineProcess files in the plugin linux-64 folder to check if they have executable permission for the current user.
3)Thirdly,you need to check if your execution program has executable permission.
4)Fourthly, 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.
If you have done the above steps, you can enter plugin folder and execute the following command to check if the QT plugin can be use properly, if there are result pdf file in the folder (/usr/local/), that mean the QT plugin have no problem.
Code: Select all
echo "<P>test text</p>" |./Html2Pdf "placeholder" "/usr/local/output.pdf" 800 600 0 0 0 0 1


Sincerely,
Ula
E-iceblue support team
User avatar

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

Tue Dec 05, 2023 6:17 am

the files have executable permissions, and ldd on html2PDF did not show any missing dependencies. However, executing the html2pdf command from terminal hangs. no pdf is generated, no errors are reported, and the command does not return a result.

garethsuarez
 
Posts: 4
Joined: Tue Nov 28, 2023 5:18 am

Tue Dec 05, 2023 9:06 am

Hi,

Thank you for your feedback.
I have uploaded the new Qt plugin to our server. You can download it through the following link, and then replace the original plugin in your project and test it again.

Qt download link: https://www.e-iceblue.com/downloads/demo/linux-64.zip

Sincerely,
Ula
E-iceblue support team
User avatar

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

Tue Dec 05, 2023 8:26 pm

After replacing the previous plugins directory content with the contents of the zip file, and granting execute permissions to html2pdf and QtWebEngineProcess, I get the same result. echo "<P>test text</p>" |./Html2Pdf "placeholder" "/usr/local/output.pdf" 800 600 0 0 0 0 1 does not return or provide an error, it just hangs in the terminal until I hit ctrl-c, and no pdf is ever generated.

garethsuarez
 
Posts: 4
Joined: Tue Nov 28, 2023 5:18 am

Wed Dec 06, 2023 10:08 am

Hi,

Thank you for your feedback.
I have uploaded a complete demo to our server. I am using the version of Ubuntu 20.04. You can download through the following link and have a test. If you have any issue, just feel free to contact us.

Download link: https://www.e-iceblue.com/downloads/demo/demo35291.zip

Sincerely,
Ula
E-iceblue support team
User avatar

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

Return to Spire.PDF