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.

Fri Jul 28, 2023 7:27 pm

I've been following the direction in the "C#/VB.NET: Convert HTML to PDF" tutorial using the "Convert an HTML String to PDF with QT Plugin" topic to create a .Net Core controller to handle converting an HTML string to a PDF. Everything is working great in windows. However, when I deploy it to linux and use the linux plugins, I face issues with the library. The PDF file is simply not being created. The code is not generating any errors, and debugging shows the HTML string and the plugin path are correct. When I debug the code linux it renders a blank PDF page with a 0 content-length.

HtmlConverter.Convert(htmlString, stream, true, 100000, new Size(1648, 1280), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);

The application runs at a dotnet 7, with a Debian GNU/Linux version 11. Any help would be greatly appreciated. Thanks!

wallacecastro
 
Posts: 2
Joined: Fri Jul 28, 2023 7:15 pm

Mon Jul 31, 2023 2:47 am

Hi,

Thank you for your feedback, we apologize for any inconvenience caused.

To address the problem, we kindly request you to check the permissions of the Qt plugin folder. Please ensure that it is set to 755 by executing the command "chmod -R 775 plugins" in the respective directory. Additionally, if you are running the system in a non-GUI environment, please install Xvfb and start your project using the command "xvfb-run".

Furthermore, we suggest that you execute the following command within the plugins directory to check for any missing dependencies:
echo "<p>test text</p>" |xvfb-run ./Html2Pdf "placeholder" "output.pdf" 800 600 0 0 0 0 1
If any dependencies are lacking, please proceed with the necessary installation.

After performing these steps, we recommend testing the functionality again. If you encounter any further difficulties, please feel free to contact us at any time. We are here to assist you.

Thank you for your cooperation, and we appreciate your patience.

Best regards,
Triste
E-iceblue support team
User avatar

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

Tue Aug 01, 2023 10:24 pm

Hi,
I gave permissions to the folder and installed all the libs missing to finally be able to run the command
Code: Select all
echo "<p>test text</p>" |xvfb-run ./Html2Pdf "placeholder" "output.pdf" 800 600 0 0 0 0 1
.
It ran successfully as you see the logs:
Code: Select all
@waacastro ➜ /workspaces/Html2Pdf/Html2Pdf/plugins $ echo "<p>test text</p>" |xvfb-run ./Html2Pdf "placeholder" "output.pdf" 800 600 0 0 0 0 1
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-vscode'
@waacastro ➜ /workspaces/Html2Pdf/Html2Pdf/plugins $


But when I run my application and use the Spire PDF library, I still get the same errors, generating a blank PDF page with a 0 content-length.
I'm using version 9.7.17 for Spire.PDF package.

wallacecastro
 
Posts: 2
Joined: Fri Jul 28, 2023 7:15 pm

Thu Aug 03, 2023 8:30 am

Hi,

Thanks for your feefback.
After executing the command we previously shared, a PDF document should be generated in your current directory. Please check the folder where the command was executed and verify if the PDF file has been created successfully.

In addition, it would be helpful if you could provide us with the HTML string and code snippet you used during your testing. YOu can share them with us via email ([email protected]) or attach them here. And we would like to confirm if your project for converting HTML to PDF is based on .NET7?

We appreciate your cooperation in helping us resolve this matter promptly. If you have any further questions or concerns, please don't hesitate to let us know. We are here to assist you.

Thank you once again for your valuable feedback.

Best regards,
Triste
E-iceblue support team
User avatar

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

Return to Spire.PDF

cron