-
Notifications
You must be signed in to change notification settings - Fork 67
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
Pictures no longer appear #24
Comments
I see, that's strange. Can you push a PR with a unit test that shows the issue? |
Yes, it's strange but the issue is already identified. I found this I confirm the workaround: if I remove width and height attributes, it works. |
Ok, thanks for confirming that it's an upstream/parent issue. |
I made a mistake about the workaround. The bug exists with or without html attributes. I opened a PR with an unit test. The test fails with wkhtmltopdf library 0.12.16 but it's good with 0.12.5 (win-64). |
Ah I see. I've added your unit test, thanks for your contribution. Unfortunately I think we're completely blocked by the issue in the parent project though. |
I have same problem using 0.12.6 (and no issue on 0.12.4), any updates on this issue? |
@ramakrishnaindpro It looks to be an issue with the parent wkhtmltopdf project, so it's not something that can be fixed in this .NET wrapper. See this issue: wkhtmltopdf/wkhtmltopdf#4832 |
Is there any chance this issue is with Here's link to this stack overflow lead: Also changelog for version 0.12.6 supports this claim: |
For me it works when first converting the image to a base64string and then including the image in the HTML in this form: src="data:image/png;base64,". |
Maybe, but it seems to work if width/height is removed, so doesn't seem to be related to blocked access to local files (the example in the parent ticket was using an image hosted on a web server as well, so not local file). |
It looks like @Gunock findings are accurate. If you look at the doc changes for this parameter in wkhtmltopdf: Temporary Solution: After digging into the code, I found, that 'BlockLocalFileAccess' in 'LoadSettings' (which can be applied to 'ObjectSettings'), can be set to 'false', which also solves the issue. (this is not technical advice, but only the way I solved it. Downgrading to an old version might lead to bugs in previous versions, or can have security issues, which are solved in the new version) |
Since the initial issue declared by @gitfreud is not directly correlated to the local-file-access-issue and the disabled local-file-access is affecting not only images, I created a new issue, with the short description for a temporary soluation. Hope that's okay. (#31) |
@johguentner Your suggestion is totally awesome! Thanks for your effort |
For sure @mortb! You're welcome! |
It looks like this was related to the defaults changing in the parent library from version 0.12.5 to 0.12.6. BlockLocalFileAccess is the key here. |
Xpost here: wkhtmltopdf/wkhtmltopdf#4832 (comment) Silly comment just in case someone is in my situation: I've been struggling for hours without the images appearing in the PDF while they appeared if I opened the HTML in the browser. It happened that I was opening an old "template" that pointed the images to v0.12.4 was not verbose about this. I'm not reopening this bug, even not suggesting there's a bug. Only logging this to help people googling, as a google search about [wkhtmltopdf not rendering images] will probably lead to this "Pictures no longer appear" issue. |
How can I do it? I am using wkhtmltopdf in a project that is development in C#, aspx and javascript. In my case I get the URL of the DB but the image is hosted on amazon, the problem I have is that the image when generating the pdf if it has one page the logo is displayed normally but when it has 2 or more pages the logo in header is displayed only sometimes. |
@Jymmy3024 Perhaps you can proxy/cache the image in your web site so it's not a call into S3? |
I don't know if is because the proyect is old, but it don't allow me to use localStorage |
I don't think I can help you with that, just giving you suggestions on how to potentially solve the issue with your images. Bottom line is that it's best to have everything local when generating the PDFs, especially since it's also single-threaded. |
Hello,
Since 1.3.0 version pictures (like .png) no longer appear.
I checked after just changing runtime for 0.12.5 and it works fine.
The text was updated successfully, but these errors were encountered: