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.

Mon Mar 13, 2023 4:57 pm

Hello,
I'm trying to use the QT Plugin to convert a page to PDF. The page is an Angular application, which opens and renders correctly when opened directly from the browser.

The issue I'm having is Spire.Pdf is generating a blank PDF. I'm trying to troubleshoot why, but there is little to no documentation on this. So far here are my findings

* The page is making only 1 API call when using Spire.Pdf, there should be multiple
* I'm suspecting there are console errors happening (possibly due to QT Plugin not supporting modern JavaScript format or polyfills). Is there a way to save the output of the console?

Here is the code I'm using
Code: Select all
//Specify the URL path
string url = "http://localhost:4200/print-mode";

//Specify the output file path
string fileName = "UrlToPdf.pdf";

//Specify the plugin path
string pluginPath = "C:\\temp\\QT_Plugin";

//Set the plugin path
HtmlConverter.PluginPath = pluginPath;

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


Your help is appreciated, how can you troubleshoot QT Plugin issues?

I can provide a live Page privately if you need it for testing

Thanks,
Mark

mark.trounev
 
Posts: 4
Joined: Mon Mar 06, 2023 7:43 pm

Tue Mar 14, 2023 6:30 am

Hi Mark,

Thanks for your inquiry.
I have tested the conversion process on our end and were unable to replicate the issue that you reported. In order to assist you further, could you please provide us with the following messages? You can send them to us via email ([email protected]), thanks for your assistance.
1) the version of Spire.PDF and QT plugins you are using.
2) your test web page.
3) your application type, such as Console App .NET Framework 4.8.

Sincerely,
Triste
E-iceblue support team
User avatar

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

Tue Mar 14, 2023 12:47 pm

I emailed you the source code, I hope you can find the root cause of the issue.

Thanks,
Mark

mark.trounev
 
Posts: 4
Joined: Mon Mar 06, 2023 7:43 pm

Thu Mar 16, 2023 4:01 am

Hi Mark,

Thanks for sending your further information to us.
Your web page uses the Javascript to dynamically generate page content, and there is also a long delay in writing out the content. The QT plugin triggers the conversion based on loaded event. However, your web content has not completed the content rendering before the loaded event triggers, so the content is not drawn successfully. It is recommended that you avoid dynamic loading or ensure that content is loaded before the Loaded event is triggered.

Please let me know if you have any questions.

Sincerely,
Amy
E-iceblue support team
User avatar

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

Thu Mar 16, 2023 12:31 pm

Hello Amy,
Thank you for getting back to me. What is the solution then? Most modern web apps are single-page applications and the rendering happens after the loaded event.

Is there a way to tell the QT Plugin to delay the rendering or manually trigger based on a custom event on the page? I know other libraries have such functionality.

Thanks,
Mark

mark.trounev
 
Posts: 4
Joined: Mon Mar 06, 2023 7:43 pm

Fri Mar 17, 2023 3:31 am

Hello Mark,

Thanks for your response.

Unfortunately, as far as I know, there is no way to delay the rendering of a QT Plugin or trigger it manually based on a custom event on the page. This is because the rendering process is tightly integrated with the browser's loading and rendering pipeline and cannot be easily controlled by external libraries or plugins.

I’ m sorry that only we suggest your methods of avoiding dynamic loading or ensuring that content is loaded before the Loaded event is triggered are feasible at present.

Sincerely,
Amy
E-iceblue support team
User avatar

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

Return to Spire.PDF

cron