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

wicked_pdf https image url not rendering in pdf file #848

Open
prashant-maropost opened this issue Aug 29, 2019 · 3 comments
Open

wicked_pdf https image url not rendering in pdf file #848

prashant-maropost opened this issue Aug 29, 2019 · 3 comments

Comments

@prashant-maropost
Copy link

Issue description

I am rendering dynamic HTML content in pdf file using wicked pdf gem. The problem I am facing is the image is not rendering into generated pdf. source URL is forcefully redirected to HTTPS instead of HTTP. Is there any way out to render the https link from wicked pdf gem

I had tried to hit image URL manually on the browser is forcefully redirected to HTTPS instead of HTTP http://designmodo.com/demo/emailtemplate/images/header-background.jpg

Expected or desired behavior

the give image URL should be rendered in pdf created

System specifications

Linux centos 6.7, ruby version 2.3.6, wicked_pdf (1.1.0)

@unixmonkey
Copy link
Collaborator

If there's a resource you can't render from an html file, you could always try retrieving it beforehand and embedding it with something like what is shown in this comment: #36 (comment)

@goodanthony
Copy link

@prashant-maropost, bellow works
<%= wicked_pdf_image_tag( request.ssl? ? photo["first_resize"] : photo["first_resize"].gsub("https://", "http://")) %>

@unixmonkey
Copy link
Collaborator

@iamfree-com The original poster said that his image is forcefully redirected to HTTPS when you request over HTTP, so while your solution may work for you, it won't in this case.

@prashant-maropost I believe the issue you are describing can be solved by installing one of the more recent versions of wkhtmltopdf.

There were some versions of wkhtmltopdf (in the earlier 12.x version range) that used SSLv3 for HTTPS. Many hosts disabled SSLv3 at the router layer to prevent Heartbleed attacks, so many (but not all) HTTPs requests just kind of stopped working when they did that.

I recommend updating to the newest wkhtmltopdf version and seeing if that solves your issue. If your CentOS package repository doesn't have one new enough, try the wkhtmltopdf-binary gem.

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

3 participants