Share via


Rotativa BuildPDF method takes long time and breaks on server for large data

Question

Friday, June 24, 2016 7:30 PM

Hi,
I'm trying to generate PDF with Rotativa BuildPDF helper method. I have more than 10,000 records to be displayed in a table on pdf. This works fine in local, taking more than 4min but after deployment it fails in between and doesn't generate the pdf. With the help of logging I saw the error saying 

QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: 8

QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: 8

QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: 8

QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: 8

Qt: INTERNALL ERROR: failed to install GetMessage hook
Qt: INTERNALL ERROR: failed to install GetMessage hook
QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: 8

Qt: INTERNALL ERROR: failed to install GetMessage hook
Qt: INTERNALL ERROR: failed to install GetMessage hook
QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: 8

QObject: Cannot create children for a parent that is in a different thread.
(Parent is QTcpSocket(0x16ccf318), parent's thread is QThread(0x163b1fd8), current thread is QThread(0x4e0b4cd8)
QObject::startTimer: QTimer can only be used with threads started with QThread
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QNativeSocketEngine(0x16ccf2d8), parent's thread is QThread(0x163b1fd8), current thread is QThread(0x4e0b4ce8)
QSocketNotifier: Can only be used with threads started with QThread
QEventDispatcher: Failed to create QEventDispatcherWin32 internal window: 8

QObject: Cannot create children for a parent that is in a different thread.
(Parent is QNativeSocketEngine(0x16af9e40), parent's thread is QThread(0x163b0ec8), current thread is QThread(0x16daf1b8)
QSocketNotifier: Can only be used with threads started with QThread

I'm finding it difficult to fix this error. Please guide me for any other alternative. 

I tried to use GetBytes method instead of BuildPDF. But GetBytes method is even slow and breaks if I have records more than 5000.

All replies (5)

Friday, June 24, 2016 7:39 PM

Hi there,

Looking at the Kudu documentation it seems Rotative is not supported. Take a look at this documentation. At the bottom Rotativa is mentioned as an unsupported library.

Web Apps run in a sandboxed environment (threads and connection limits f.e.) and that implies some limitations.

Please mark answered question as anwered to let others know about it.


Friday, June 24, 2016 7:54 PM

Hi there,

Looking at the Kudu documentation it seems Rotative is not supported. Take a look at this documentation. At the bottom Rotativa is mentioned as an unsupported library.

Web Apps run in a sandboxed environment (threads and connection limits f.e.) and that implies some limitations.

Please mark answered question as anwered to let others know about it.

Hi,
Thank you for the quick response.

Can you please suggest me a framework which generates pdf from html code with a header and footer along with the capability to handle large data at a faster pace.

I'm deploying my solution on to IIS not to Azure as of now.


Tuesday, June 28, 2016 9:16 AM

Hi Praveen,

Give it a try with Pechkin: .NET Wrapper for WkHtmlToPdf DLL, library that uses Webkit engine to convert HTML pages to PDF.

According to the same documentation:

PDF generation from HTML

There are multiple libraries used to convert HTML to PDF. Many Windows/.NET specific versions leverage IE APIs and therefore leverage User32/GDI32 extensively. These APIs are largely blocked in the sandbox (regardless of plan) and therefore these frameworks do not work in the sandbox.

There are some frameworks that do not leverage User32/GDI32 extensively (wkhtmltopdf, for example) and we are working on enabling these in Basic+ the same way we enabled SQL Reporting.

Hope this helps!

Best Regards,
Carlos Sardo


Wednesday, June 29, 2016 3:19 PM

Hi Praveen,

Give it a try with Pechkin: .NET Wrapper for WkHtmlToPdf DLL, library that uses Webkit engine to convert HTML pages to PDF.

According to the same documentation:

PDF generation from HTML

There are multiple libraries used to convert HTML to PDF. Many Windows/.NET specific versions leverage IE APIs and therefore leverage User32/GDI32 extensively. These APIs are largely blocked in the sandbox (regardless of plan) and therefore these frameworks do not work in the sandbox.

There are some frameworks that do not leverage User32/GDI32 extensively (wkhtmltopdf, for example) and we are working on enabling these in Basic+ the same way we enabled SQL Reporting.

Hope this helps!

Best Regards,
Carlos Sardo

Hi Carlos,
Thank you so much for the response. I'll surely give it a try.


Wednesday, June 29, 2016 5:22 PM

Hi Carlos,
I tried with Pechkin wrapper, it works fine. But my requirement needs a static header with css and dynamic footer with css for my pdf. To whatever I tried till now with Pechkin, I couldn't find much help on this regard for header and footer on Pechkin. Let me know if you have any other suggestions or advice me for any other approach.