Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images are not rendered #10

Open
EEaglehouse opened this issue Aug 1, 2019 · 15 comments
Open

Images are not rendered #10

EEaglehouse opened this issue Aug 1, 2019 · 15 comments

Comments

@EEaglehouse
Copy link

EEaglehouse commented Aug 1, 2019

I have a problem with rendering HTML containing embedded <img> tags. The images do not appear except for a little empty square in the PDF document. The same HTML text that is used to generate the document executes perfectly in a browser.

Here is what I have tried so far, all without success:

  1. I thought IronPDF might not have images enabled in the demo version. I added the license key to my web.config file and the watermark disappeared, but still no images were included.
  2. I was originally using image tags that had relative URLs. I changed to using fully-qualified absolute URLs. This change made no difference.
  3. The documentation is very unclear on the subject, but implied a base URI might be necessary when calling the method used to render the PDF document. I added a base URI of my web server where the images were being sourced. This made no difference.
  4. Thinking the image tag itself might be the problem, I removed the final "/". E.g. <img src='...'/> and <img src='...'> both produce no images in the PDF.
  5. I came across some information while browsing for a solution that later versions of IronPDF may have fixed some issues with rendering images. I was using version 4.4.9 and upgraded to 5.2.0. This also made no difference.
  6. I considered that some image formats may not be supported so, instead of all JPEG files, I also tried PNG. Still there were no images rendered in the PDF. Advertising for IronPDF mentions both these formats are supported, but neither were rendered.
  7. I created an additional web site in IIS (on my development machine) just to run a simple test. I created an HTML string with little more than an image tag; the image URL was independent of the base URI of my web server. While debugging, I rendered a test string into a separate PDF document. This test PDF actually produced an image, but my other documents (with the same base URI at the same time) did not include images. Running the test again after replacing the test URL with a real URL resulted in the image not being rendered. I am completely astounded that such a simple test could fail. I had Fiddler running to view traffic to the web site(s), and did not see any attempts to retrieve images during rendering, which is highly suspicious and indicates that it is a bug in IronPDF.

Without the ability to render images, this product is pretty worthless to me.

What black magic do I have to perform in order to get IronPDF to include real images from tags in the document? There aren't even any error messages I can research. How can I get information about why IronPDF isn't working? Or is this just a bug and I will have to wait for an update?

@JosephGarrone
Copy link

I am having this same issue. Was evaluating this piece of kit, but if its not going to even render images... Bit of a show stopper. Base64 data URIs appear to work as a semi-workaround.

@IronPdf
Copy link
Owner

IronPdf commented Aug 21, 2019 via email

@Biggyboo
Copy link

Biggyboo commented Apr 1, 2020

Hello,
Have you got some news from this error?

@EEaglehouse
Copy link
Author

EEaglehouse commented Apr 1, 2020

No. The support people at Iron Software never followed up.

We got around the issue by converting our images to Base64 and embedded them in our documents as Data URLs. It's infuriating that we had to do this for a paid product that is supposed to do this already, but it works.

Thankfully, we control the documents we're creating. If we had to pull third-party documents, we would have had to create a whole engine to retrieve and re-encode the images simply to spoon-feed this tool. That would have been untenable and grounds for dumping IronPdf and replacing it with something that worked.

I suspect it had something to do with the image's URI somehow not matching the document's base URI. We develop on a deadline and weren't being paid to debug someone else's problem. I never pursued it any further, assuming Iron Software would actually take the time to look into this major bug.

We've since upgraded to their latest version, but I haven't had the time to see if this bug was fixed. They never bothered to get back to me, so I don't know if they ever addressed it.

@Biggyboo
Copy link

Biggyboo commented Apr 1, 2020

Thanks for this fast reply. I will try your "solution".

@eoehen
Copy link

eoehen commented Sep 28, 2021

@EEaglehouse @Biggyboo @JosephGarrone

I had same problem, that Images are not rendered.

<img src="../Images/my-image.png" />

I found the reason. RenderHtmlAsPdf needs a base directory path (BaseUrlOrPath) for the related html template assets.
This should be the directory of the html template file.

renderer.RenderHtmlAsPdf(htmlContent, baseDirectoryPath);

With the correct BaseUrlOrPath, alle images are rendered.
Maybe this will help you.

@stmax82
Copy link

stmax82 commented Apr 18, 2023

@eoehen for some reason this doesn't work for me.. still getting no images.

I have the following file structure:

/pdf-templates/index.html
/pdf-templates/image.jpg

Running RenderHtmlFileAsPdf("/pdf-templates/index.html") shows images.

Reading the contents of index.html into a string variable and running RenderHtmlAsPdf(indexHtmlContent, "/pdf-templates") does not show images.

@IronPdf
Copy link
Owner

IronPdf commented Aug 1, 2023 via email

@IronPdf
Copy link
Owner

IronPdf commented Aug 3, 2023 via email

@JosephGarrone
Copy link

@IronPdf seems something might be up with your mailing lists. Everytime I receive an advertising email from yourselves, you're also posting it to this specific Github issue.

@IronPdf
Copy link
Owner

IronPdf commented Aug 8, 2023 via email

@IronPdf
Copy link
Owner

IronPdf commented Sep 15, 2023 via email

@IronPdf
Copy link
Owner

IronPdf commented Mar 8, 2024 via email

@IronPdf
Copy link
Owner

IronPdf commented Jun 12, 2024 via email

@ReinisV
Copy link

ReinisV commented Jun 12, 2024

@IronPdf seems something might be up with your mailing lists. Everytime I receive an advertising email from yourselves, you're also posting it to this specific Github issue.

maybe to resolve your issue you must make a pilgrimage to one of their conferences to commune with the elders of IronPdf?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants