Welcome Guest Search | Active Topics | Sign In | Register

Converting HTML to PDF doesn't render images on certain environments. Options
Bart c.
Posted: Thursday, October 13, 2022 7:21:00 AM
Rank: Newbie
Groups: Member

Joined: 10/13/2022
Posts: 4
Hi,

I have a problem with EO.Pdf library that I cannot really resolve or even debug properly on my own. I will describe it as best I can and include all the information I managed to gather.
We are using EO.Pdf to convert HTML to PDFs using the following method:

Code: C#
HtmlToPdf.ConvertHtml(htmlContent, outStream, htmlToPdfOptions);


This code has been running in our production servers for quite some time now (two years at least) and there were no obvious problems with it. Recently however we update the version of EO.Pdf from 19.2.91 to 22.1.94. Nothing else in our setup changed. It seemed to work fine in testing, but after deploying the version to production it turned out that images are no longer rendering properly. We managed to reproduce this behavior in our testing environments as well, but it never occurred in our dev environments. There is no exception of any kind either, the whole conversion passes, but simply doesn't render the images.

The dev environments are the following:
Windows 10 Enterprise, version 21H2, OS build 19044.2130 running on a physical machine
The testing environments where the bug reproduces are the following:
Windows Server 2019 Datacenter running on Amazon EC2

The images in question are like this:
Code: HTML/ASPX
<img alt="Whatever.jpg" src="https://Whatever/LinkToFile">


The src is a valid link to a file that is accessible from the web (I tried using links to images on wikipedia)
Also worth noting that in the final PDF the alt is always rendered.
I tried opening the HTML file before the PDF conversion (the input file) in Chrome separately and in renders the images correctly.
If the src is not a link but instead a base64 image the image renders correctly.

I tried increasing the min timeout to 3 seconds, but that didn't change anything.

The license is correctly applied in production. We run a trial on testing environments. We also run a trial on dev environments. To reiterate, the bug happens on prod and testing but doesn't happen on dev, so it seems it's not related to the correct license.

I tried updating the license to the newest 22.2.49 but it didn't help at all.

Any help here would be greatly appreciated, because for now the only solution we have is to roll back the version upgrade to 19.2.91.

Thanks a lot
eo_support
Posted: Thursday, October 13, 2022 9:51:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Do you have RDP access to your production server? If so can you try to run our installer on the system, then run EOPdfDemo application and then run All Demos -> HTML to PDF -> Convert HTML to see if you can render images from there?
Bart c.
Posted: Monday, October 17, 2022 5:38:32 AM
Rank: Newbie
Groups: Member

Joined: 10/13/2022
Posts: 4
Hi.
I did the steps you mentioned above and when I generate the PDF from the EOPdfDemo app it renders the images. Our conversion process still doesn't work though, even when using the machine that has this EOPdfDemo app installed.
eo_support
Posted: Monday, October 17, 2022 1:06:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

This most likely has to do with the permission of the account under which your application is running. If it does not have network access permission, then it won't be able to fetch and render the image over the network.

If you continue to have problem, please try to duplicate the problem with a simple console application in your test environment and then provide RDP access to us to that environment. We will then connect to your test system and see what we can find.

Thanks!
Bart c.
Posted: Tuesday, October 18, 2022 8:37:49 AM
Rank: Newbie
Groups: Member

Joined: 10/13/2022
Posts: 4
Hi,

Unfortunately it doesn't look like it's a permissions problem because if instead of using
Code: C#
HtmlToPdf.ConvertHtml
I use
Code: C#
HtmlToPdf.ConvertUrl
the images start to render (and the image links point to the same resource in the HTML and on the live website).
If it were a permissions issue I would expect the library to not be able to access the internet at all. Instead it looks like there is some problem in ConvertHtml that is not present in ConvertUrl.

As to the RDP access to the test environment, I don't even have access there, let alone giving anyone access to it. Company policies and such.

I could maybe run through all the version of EO from the one that worked and see which one breaks down. Would that info help you in any way?

Thanks a lot.
eo_support
Posted: Tuesday, October 18, 2022 10:14:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Bart c. wrote:
As to the RDP access to the test environment, I don't even have access there, let alone giving anyone access to it. Company policies and such.


This is what we were asking you use to test our EOPdfDemo sample application. The test is only valid if you use run our sample application on the server that you are seeing the problem. How did you test it without RDP access to the server?

If ConvertUrl works but ConvertHtml doesn't, then you should check your BaseUrl setting. However BaseUrl is irrelevant for absolute Urls. So if you have tested using absolute external Urls (such as an image on Wikipedia as you mentioned) and it still doesn't work, then that's a different issue and we would need access to your system in order to get to the bottom of it. If you do not have RDP access, you can create a simple test site to demonstrate the problem and give us access to that site. We will need to add logs upload test version of our DLLs in order to troubleshoot such problems.
Bart c.
Posted: Wednesday, October 19, 2022 5:39:59 AM
Rank: Newbie
Groups: Member

Joined: 10/13/2022
Posts: 4
eo_support wrote:
Bart c. wrote:
As to the RDP access to the test environment, I don't even have access there, let alone giving anyone access to it. Company policies and such.


This is what we were asking you use to test our EOPdfDemo sample application. The test is only valid if you use run our sample application on the server that you are seeing the problem. How did you test it without RDP access to the server?


To answer on this question. What I mean by sayin I don't have RDP access to test environments is me personally. There are people in my organization who do and I asked them to perform this test.

As to the other part, like I say, it's not possible as far as I'm aware to let you RDP to our test environments for security and company policy reasons.
Is there maybe a debug or extended logging version of EO.Pdf that we could utilize? I could send you those logs afterwards and maybe try figuring something out that way?
eo_support
Posted: Wednesday, October 19, 2022 8:51:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

No. There is no extended logging because the enormous size of the browser engine. It is not possible for us to add logs everywhere. What we do is to temporarily add logs at suspected area and then run those builds on your server. We would then collect and analyze the logs that should help us to narrow down the problem, then add more logs and then run it again on your server. We would need to do this over and over again until we get to the root of the problem. In order to do this we would need two things to start with: 1. A test project that demonstrates the problem; 2. Access to your server so that we can replace the DLLs with our test DLLs.

Once we have those two things we will be able to investigate into this issue further.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.