mileszs / wicked_pdf

PDF generator (from HTML) plugin for Ruby on Rails
http://www.mileszs.com/wicked-pdf-plugin
MIT License
3.54k stars 647 forks source link

wicked_pdf_javascript_include_tag renders shows the code on the page #366

Closed AlainPilon closed 9 years ago

AlainPilon commented 9 years ago

I used both the CSS and JS helper in my layout:

%html{:lang => I18n.locale} %head = wicked_pdf_stylesheet_link_tag 'application' = wicked_pdf_javascript_include_tag 'application' ....

When I used the CSS alone, everything works, but if I add the JS, it will output on the page the full content of the application.js file. Any idea why? I will be rendering a lot of charts on the PDF which requires a lot of JS files, hence the reason to use the application file instead of calling each one individually.

unixmonkey commented 9 years ago

Try using regular javascript_include_tag , or base64 encode it. Some large JS files include markup, that could break out of the <script> tag that is created with wicked_pdf_javascript_include_tag.

Let me know how it goes.

unixmonkey commented 9 years ago

Bump since adding the last comment on my phone caused everything after the <script> tag to not show, and it appeared incomplete.

Also, check out #314, and #257

AlainPilon commented 9 years ago

I fixed the used by only including the JS I needed as you suggested. Just annoying.