[Html2PdfConverter] recommended wkhtmltopdf binaries no longer appear to be working?

Forge Component
(60)
Published on 17 May by Guilherme Pereira
60 votes
Published on 17 May by Guilherme Pereira

We've been using this component for a few years now, we upgraded to latest versions when upgraded to O11.

Since a few days ago, sometime between April 15 and 16, the library has been failing to generate PDF files, either throwing this error or generating a 0 byte PDF (with no errors, even with DEBUG logging on)

Is anyone else experiencing this, or better yet, have found a resolution?

The strange thing is that test area (/HowToPdf.aspx) of the component is able to successfully generate PDFs from the same URL that it fails on.

Errors:

QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.

Here are things we've tried, update to latest bleeding edge (wkhtmltox-0.13.0-alpha-7b36694_mingw-w64-cross-win64)

This creates more errors:

  • Error Creating PDF:Qt: Untested Windows version 10.0 detected!
  • The switch --header-html, is not support using unpatched qt, and will be ignored.
  • SetProcessDpiAwareness failed: "COM error 0xffffffff80070005  (Unknown error 0x0ffffffff80070005)"
    fontEngine: AddFontMemResourceEx failed
    fontEngine: AddFontMemResourceEx failed
  • QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.
  • Exit with code 1 due to network error: OperationCanceledError


Hi,

You're not alone. We are experiencing the same problems in a cloud environment.

Suddenly our PDF generationfunctionality has stopped working. We use the OutSystems cloud with version 11and version 1.1.16 of your component. The action GeneratePDFExtensiongives back as MessageOutput ‘Qt: Untested Windows version 10.0 detected!’What happens is that the server gives a timeout error when rendering the PDFpage. When I copy the link in the browser manually I get the requested pagefast and correct.

Sadly, we haven't yet a solutions.

Menno

Hi Menno, bummer.

Did this just recently start for you? It seems to have started very recently for us.

We are not seeing a timeout reported anywhere in service center, is there a place we can check for this? We are a hosted enterprise customer.

Altai


Hi Altai,


Have you installed a new version of the binaries by any chance? Other than that or potentially an issue with wkhtmltopdf that could be related with something like for example windows updates I see no reason for it to start failing suddenly. But I'm speculating.


But when you generate from the component HowToPdf it works but from your code doesn't? In that case I suggest you open the component (it's open source) itself and check how the generation is done ´. Have anything changed in your generation code?


Cheers,

Guilherme

Hi Guilherme,

- Yes, we've tried the stable 12.5, 12.4, as the latest alpha 13.0 version. All of them appear to produce the same behavior but with varying error messages.

- Also, yes, the generate from the component works everywhere, but from the app it doesn't in two environments and works perfectly fine in a third environment. We had not changed anything in the apps that use the component nor the HTML2PDF related components including binaries, before it started failing. :(

The confusing part is why one environment works while the other does not, everything does appear to be identical between them.

Altai

Hi Altai,


It may very well be some kind of bug introduced in wkhtmltopdf in those versions but like you said the fact that it works in one environment while not on the others is quite strange specially if they have the same configuration.


Is there any specific reason you've upgraded? Are you taking advantage of a new feature? I personally am using the alpha 13.0 of the mingw based version and haven't found any issues in my apps. Is that the one you've tried? If not can you try it?


Cheers,

Guilherme

Guilherme Pereira wrote:

Hi Altai,


It may very well be some kind of bug introduced in wkhtmltopdf in those versions but like you said the fact that it works in one environment while not on the others is quite strange specially if they have the same configuration.


Is there any specific reason you've upgraded? Are you taking advantage of a new feature? I personally am using the alpha 13.0 of the mingw based version and haven't found any issues in my apps. Is that the one you've tried? If not can you try it?


Cheers,

Guilherme

Apologies. I saw now in the initial post that's the version you've tried that same version.


In that case I'm really out of ideas of what may be causing it. Does it fail for all PDF's in the same app (different pages) or only for a specific one?


Is the link shareable in anyway so I could try and replicate the issue?


Cheers,

Guilherme

Hi,

We've been on that same version before it started failing. Although it looks like the alpha version today is from a newer commit than a couple of weeks ago.

We upgraded the forge component to 1.1.16 due to migrating to O11 and also upgraded the binaries at the same time.

We've been playing with different versions of the binaries just in case one of them has a bug, but so far no resolution.

Hi Guilherme,

Yes, it appears to fail for all apps in the environment if the component is not working. Or it works for all the apps.

Here is an app you can go to and try, you will have to find an item, show full details and then click the download PDF button.

https://apps.kent.edu/jobdescriptions/

Thanks!


Hi Altai,


I've tested with that URL on 2 different infrastructures (one with 0.13.0 alpha installed and other with 0.12.1 a very old version).


They both generated the PDF but in the one using the newest version the file is smaller but some parts are not correctly rendered (missing page title and perhaps other parts).


Can you try with that older version and see if it works for you?


Cheers,

Guilherme

Hi Guilherme,

We have an update, we think it's working now. Things we did for future reference.

  1. Tried different versions and compilers, settled on the latest stable (v0.12.5) MSVC x64 build, as we are on the .NET stack (https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.msvc2015-win64.exe)
    1. This appears to process a little faster
    2. The alpha MinGW one produces a 0 byte file from the consumer app, it could possibly be related to something on the page it doesn't like.
  2. Removed a redundant token check from our consumer app, functionally this shouldn't have changed anything :)

Thanks for your input!

Altai

altai otgonyin wrote:

Hi Menno, bummer.

Did this just recently start for you? It seems to have started very recently for us.

We are not seeing a timeout reported anywhere in service center, is there a place we can check for this? We are a hosted enterprise customer.

Altai


Hi,

Here also an update.

When debugging some more I noticed that an delete action was causing the time out. Commented out some code and did some more testing (explicit commit). This delete action caused somehow the problem. I could settle with the removal of the delete and now everything is working. Still strange, as the code didn't change.

Cheers,

Menno

Solution

Thanks Menno, Guilherme, it looks we finally found the root cause.

In our case it was related to some interplay between the Insights module's "Capture Usage" setting and the version of wkhtmltopdf.exe file. We also happened to install the new version on the day it broke.

My previous post's findings appear to be related to exactly how the specific version of wkhtml interacts with the Insights code.

Also, we can't use the alpha one just yet because the --header-html setting is not implemented, so we are using the 0.12.5 MSVC build.

Fun times!

Altai

Solution

altai otgonyin wrote:

Thanks Menno, Guilherme, it looks we finally found the root cause.

In our case it was related to some interplay between the Insights module's "Capture Usage" setting and the version of wkhtmltopdf.exe file. We also happened to install the new version on the day it broke.

My previous post's findings appear to be related to exactly how the specific version of wkhtml interacts with the Insights code.

Also, we can't use the alpha one just yet because the --header-html setting is not implemented, so we are using the 0.12.5 MSVC build.

Fun times!

Altai

Hi Altai,


Glad you found the cause. Have you tried to use a separate page for printing and disabling insights on that specific page?


Guilherme


We turned that feature off for the entire application. This particular setting, Track Usage, appears to apply to the entire app, unlike others that can be set for individual pages inside said application.


I’ll try to do some tests and I’ll update the FAQ with the findings.


Thanks for letting us know.

Hi,

I am facing issue with alpha 13.0 of the mingw based version.


Having error

  • The switch --header-html, is not support using unpatched qt, and will be ignored.
  • SetProcessDpiAwareness failed: "COM error 0xffffffff80070005  (Unknown error 0x0ffffffff80070005)"