[Html2PdfConverter] Incorrect formatting in Testing environment

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

Hi, we're having trouble with the formatting of PDFs in the testing environment. 

It works fine in the development environment but in testing none of the layout or formatting is there even though the actual data is. I've included some PDFs that show the difference. The behaviour is the same for the instances of the component in both environments, they both render pages from the development environment and other web sites correctly and render pages from the testing environment incorrectly.

The actual pages themselves both display fine in chrome and as far as I can tell the various layouts and themes are all in both environments.

Thanks in advance for any help.

Hi Zachary,

The only thing that comes to mind is that for some reason on your test environment the request done from the machine cannot load the CSS.

The only way to actually verify that is by login into the test machine and access your page from within the machine browser. That is only possible if you're using an On-Premises environment.

Are you able to do that?



Unfortunately not, we're using a cloud environment.

In that case the other possible suggestion is to generate your pdf using for example the test environment public ip. If it's a name resolution issue it may help.

If that doesn't work you should contact OutSystems Support for additional assistance.



Unfortunately using the IP address didn't work either.

It turns out though that it works fine in the production environment, which is the most important thing.

We'll contact OutSystems Support anyway since it would be useful to have it working in testing even if it's less important.


Well, we found the cause of the problem. So for anyone else having this problem, having the X-Webkit-CSP header present was the cause, removing that (and setting content-security-policy manually using the AddHeader function of HTTPRequestHandler) works. 

I don't know if this is a problem with this extension specifically or with wkhtmltopdf itself, I haven't tested that.