You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when I added the wicked_pdf_ prefix to those, it produced:
<!DOCTYPE html><html><head><metaname="viewport" content="width=device-width, initial-scale=1.0"><title>Surveyor</title><!-- wicked_pdf_stylesheet_pack_tag --><styletype='text/css'></style><!-- wicked_pdf_javascript_pack_tag --><scripttype='text/javascript'><!doctypehtml><html><head><title>Example Domain</title><metacharset="utf-8"/><metahttp-equiv="Content-type"content="text/html; charset=utf-8"/><metaname="viewport"content="width=device-width, initial-scale=1"/><styletype="text/css">
body {background-color: #f0f0f2;margin: 0;padding: 0;font-family: -apple-system,system-ui,BlinkMacSystemFont,"Segoe UI","Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;}
div {width: 600px;margin: 5emauto;padding: 2em;background-color: #fdfdff;border-radius: 0.5em;box-shadow: 2px3px7px2pxrgba(0,0,0,0.02);}
a:link, a:visited {color: #38488f;text-decoration: none;}
@media (max-width: 700px) {div{margin: 0auto;width: auto;}}</style></head><body><div><h1>Example Domain</h1><p>This domain is for use in illustrative examples in documents. You may use this
domain in literature without prior coordination or asking for permission.</p><p><ahref="https://www.iana.org/domains/example">More information...</a></p></div></body></html></script></head><body><mainrole="main" class="container-fluid application-">
...
I obtained this html with the following code in the rails console in development:
The app/javascript/packs/application.js file has a line that imports the styles from ../stylesheets/application and the views all look fine when running the application in development, staging, and production. Trying out this gem in the development rails console is not producing the correct HTML needed before I can use this gem to convert to a PDF.
I am not using the asset pipeline for my stylesheets and have no asset_host defined. rails webpacker:compile says everything is up to date.
It looks like the path coming back from the webpacker_source_url is http://example.org/pack/js/application-... which is probably why I am getting that "example domain" html document instead of the javascript I expect, but I'm not sure how to get it to load the javascript asset from the file path.
If I change the asset_pack_url in webpacker_source_url to asset_pack_path it seems to work much better, but I don't feel that's the right way to fix my problem.
Expected or desired behavior
I want to generate a PDF of the "print" view for the survey in a background job and save it to a file. I was hoping that the CSS styles would be included correctly and everything would look sweet-- I've been through the README several times, but I'm not sure what I am doing wrong.
Issue description
It appears to be inserting an "example domain" html document instead of my javascript file.
When my layout contained
stylesheet_pack_tag
andjavascript_pack_tag
it produced the following:But when I added the
wicked_pdf_
prefix to those, it produced:I obtained this html with the following code in the rails console in development:
and the
wicked_pdf.html.erb
layout file:The
app/javascript/packs/application.js
file has a line that imports the styles from../stylesheets/application
and the views all look fine when running the application in development, staging, and production. Trying out this gem in the development rails console is not producing the correct HTML needed before I can use this gem to convert to a PDF.I am not using the asset pipeline for my stylesheets and have no asset_host defined.
rails webpacker:compile
says everything is up to date.It looks like the path coming back from the
webpacker_source_url
is http://example.org/pack/js/application-... which is probably why I am getting that "example domain" html document instead of the javascript I expect, but I'm not sure how to get it to load the javascript asset from the file path.If I change the
asset_pack_url
inwebpacker_source_url
toasset_pack_path
it seems to work much better, but I don't feel that's the right way to fix my problem.Expected or desired behavior
I want to generate a PDF of the "print" view for the survey in a background job and save it to a file. I was hoping that the CSS styles would be included correctly and everything would look sweet-- I've been through the README several times, but I'm not sure what I am doing wrong.
System specifications
Rails 6.0.3.2 using Webpacker
wicked_pdf gem version: 2.1.0
wkhtmltopdf version: 0.12.6 (with patched qt)
wkhtmltopdf-binary gem version: (0.12.6.5)
Ubuntu 20.04.1 LTS
The text was updated successfully, but these errors were encountered: