-
Notifications
You must be signed in to change notification settings - Fork 646
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
Issues rending images from HTTPS #344
Comments
Hi, I have the same problem. It was working perfectly in the past and now just blank squares in the pdf.. Although when you use <%= wicked_pdf_image_tag 'image' %> helper, it works fine as well as using just links with http. |
I've tried using wicked_pdf_image_tag but it appears that that helper ONLY works for local resources. This isn't the issue at hand but just wanted to be thorough. When I try to use it to render a remote image using wicked_pdf_image_tag (either HTTP or HTTPS) it fails with the following error.
|
@jmesserer Remote images that aren't part of the asset pipeline or in |
@unixmonkey - Thanks ... I was aware of that but I'm still seeing an issue with remote images sourced from HTTPS locations as seen in my example @ http://dev.e-snapapps.com/welcome/test.pdf Doesn't work --> Works --> Thanks =~ J |
Also seeing this issue — is there anything I can do to get more verbose debug output to help narrow down the cause? |
I am also experiencing this issue. Local images render just fine, but remote images (S3, Rackspace Cloudfiles) served over SSL fail to render. |
I'm also experiencing this issue. Any ideas? It really has to do with HTTPS. This one works : http://www.etsy.com/assets/dist/images/etsylogo.0000.png |
I haven't figured anything out yet but in the meantime I was able to circumvent the issue by downloading the images I need (using httparty gem) and rendering them locally. I'm sure there's room for improvement but it works and gets my users up & running again. # download image
remote_image = 'https://www.google.com/images/srpr/logo11w.png'
local_image = "#{Rails.root}/public/images/#{File.basename remote_image}"
unless File.exists? local_image
File.open(local_image, 'wb') do |f|
f.write HTTParty.get(remote_image).parsed_response
end
end
# render in PDF
<% local_image = File.basename remote_image %>
<%= wicked_pdf_image_tag(image_path(local_image)) %>
|
It appears that the server will need See https://code.google.com/p/wkhtmltopdf/issues/detail?id=17 |
Any clue how to fix this on Heroku? |
We've encountered the same issue. Since last week assets fetched over HTTPS were no longer working. As it turns out the latest stable relase of wkhtmltopdf uses SSLv3 for its HTTPS connections. |
I've also created an issue in the wkthmltopdf binary gem project. Once there is a (pre-)release of the gem it should be possible to use it on heroku too. |
@joelcogen Thanks for pointing out that this is related to Heroku and others disabling SSLv3. I was wondering how so many people were just now starting to have issues when things have been working so well for years. |
The issue with missing images (on sites that disable SSLv3) seems fixed if you use |
Im having this issue too. No solution yet. |
+1 |
This is weird. if i set direct path of image it shows image but when i use dynamic data to show path it dosent work. here is an example. This doesn't work but when i write below code it works. how do i get dynamic data for img tag, i'm getting dynamic data for other parts like ticket price ,name and order number. |
Hi @mileszs! |
I had this same issue on Heroku serving images from CloudFlare. We'd been serving them successfully using CloudFare Pro but when we downgraded to the Free version the images stopped working when using SSL. (Seems the Pro vs Free version has some difference regarding SSL). Upgrading to the latest WKTHMLtoPDF version seemed to fix it using: |
I'm using wkhtmltopdf 0.9.9 in local dev and production. Latest version of wkhtmltopdf loads really slow on OS X for some reason so I've chosen not to go above 0.9.9. Guess I'm going to have to use local http:// for my images. Thanks for the update. |
Hi all, I had this issue on version: 0.12.1 (with patched qt). I was able to resolve it by upgrading to version: 0.12.2.1 (with patched qt) |
Has anyone found a solution to this other than copying images to a non-https location? I've tried using the Strangely this only stopped working recently, as it has been working for the past few months. I don't check the PDFs every day, but we just started noticing them not having images. We are using S3, and I suspect it's something along the lines of what @jeroenj was saying regard SSL. Is there a way to using the testing version of wkhtmltopdf with wicked_pdf, specifically on Heroku? Or is there another solution? |
Yes, all I did was a gsub on the image tags and it worked perfectly, as follows: <%= image_tag(image_url.gsub('https', 'http') %> |
@ryanwjackson Yes, you can install the newest wkhtmltopdf and copy it to your |
I ended up going with installing wkhtmltopdf directly on my computer and then using the suggestion above of a buildpack: https://github.com/paidapi/wkhtmltopdf-buildpack. And it's notable that @nfriend21's solution did work, but I see that as a bandaid rather than a fix. Hopefully someone will update the binary gem and all will be right in the world. |
FYI That Amazon discontinued support for SSLv3 in S3 on May 20th 2015. Just around that time we started having this problem with images no longer appearing in our pdf output. |
Yes, the last AWS extension was until June 8 2015 and then we faced this issue as well...
|
To add a bit of insight, I found out today that the underlying gem, Using rails on heroku, we were able to simply switch over The new gem,
Though beware, we did have some minor styling issues that needed correction with some |
It seems like the bottom line is that if you’re experiencing this issue then you probably have some dependency in the pipeline that is not updated to the most recent version. On Wed, Jun 17, 2015 at 1:45 PM, Eric Garside notifications@github.com
|
@garside solved the issue for me. Just make sure, like he said, to check formatting again. Some things shifted. |
Also, just a note to @lalitlogical, @bcackerman, and @Epigene: If you guys are on heroku, there's a heroku specific gem that works and is "more reliable" than the In our gemfile we have:
|
Thanks @garside |
+1 @garside |
I'm having issues getting my images to render too. I have a logo in my |
@jwoertink What version of Does it work with the |
I'm using gem 'wkhtmltopdf-binary-edge', '~> 0.12.2.1'
gem 'wicked_pdf' |
Does it work without the Try adding the option If that doesn't help you track down the issue, I might suggest you embed a base64 encoded image as demonstrated in #257 |
Ok, so I changed it up a bit. I did
|
@jwoertink Ah, that helps. The If you can control the server, try this: http://stackoverflow.com/a/5036301/23915 Otherwise, I'd either try an older version of the |
oh nice! Yup, that worked! Thanks so much. |
+1 @garside 👍 |
@garside 👍 |
@garside 👍 |
If it wasn't mentioned before... if you were using 'wkhtmltopdf-binary' and are switching to 'wkthmltopdf-binary-edge' it seems you need to uninstall 'wkhtmltopdf-binary' removing it and rebundling didn't work for me but it did work once I ran gem uninstall 'wkhtmltopdf-binary' |
I am having an issue that I hope you may have knowledge about.The images were missing from the PDF's I'm generating(wicked_pdf). There is an issue with HTTPS request for wicked PDF, when i replace HTTPS with HTTP it worked but i have so many PDFs and don't want to change HTTPS to HTTP. I tried updating gem to this (gem 'wkhtmltopdf-binary-edge', '~> 0.12.2.1') but this too did not work for me. I am wandering here and there for the reason why this is happening. |
@skyach-001 Please update to the latest |
Hello @unixmonkey , as per suggested i update the gem but still got error "Error message |
@skyach-001 I suggest you post this here, but it looks like your system needs Make sure to provide some info about your operating system and platform. |
As a solution, I used the system's packaged wkhtmltopdf in the containers, and it works fine. Only drawback : it downloads a hell lot of dependencies. |
Version 0.12.5.0 appears to be incompatible with the Heroku-18 stack. The only way I could get it to work on Heroku was to load S3 images over http rather than https. This is a better substitution than the ones that have been mentioned above — it's nil-safe and anchored to the start of the string:
|
@McGeekiest This solution should not have anything to do with the Heroku 18 stack, but loading HTTPS resources over many networks (including AWS). The workaround of loading assets over HTTP isn't always available (like for domains that force SSL), so you may need to do something like request the content with |
@unixmonkey Understood, but I was responding to "Please update to the latest gem 'wkhtmltopdf-binary-edge', '~> 0.12.5.0' and report back." That is not an option on Heroku-18, at least out-of-the-box, due to a Also, certainly, this does not present a general solution for all HTTPS resources, but for the specific combination of Heroku and AWS the |
@McGeekiest Gotcha. Thanks for clarifying. It appears that the latest https://github.com/rposborne/wkhtmltopdf-heroku works on Heroku-18 based on this |
i my case when i change image extension .svg to .png its my image downloaded successful in my pdf |
Hi All,
A couple days ago I realized that images were missing from the PDF's I'm generating ... it wasn't an issue prior to that and I'm still trying to track down what "changed" (no code changes on my end). Anyways ... I noticed that images sourced from HTTPS are not rendering in the generated PDF's but they do render when show_as_html is enabled.
Anybody have any insight into this issue?
I've setup a working example of the issue @ http://dev.e-snapapps.com/welcome/test.pdf (for show_as_html use http://dev.e-snapapps.com/welcome/test.pdf?debug=true).
Thanks =~ J
The text was updated successfully, but these errors were encountered: