简体   繁体   中英

wicked_pdf and wkhtmltopdf to generate PDFs from files with a lot of Javascript content?

Has anyone used wicked_pdf and wkhtmltopdf to generate pdf files from rails?

wkhtmltopdf ( http://code.google.com/p/wkhtmltopdf/ ) is an c++ executable that the wicked_pdf gem ( https://github.com/mileszs/wicked_pdf ) essentially wraps. It works great for basic pdf generation of tables and reports.

We're now looking to print some pages that have a lot of javascript content. Since the processing is all done server-side, there's obviously no browser to interpret the javascript.

I've been looking around and can see that wkhtmltopdf supports some Javascript, but I'm also seeing that a lot of people are running into problems using it for complex javascript rendering.

Actually there is a browser engine in there. The WK in wkhtmltopdf stands for webkit which is the browser engine that is used to render HTML and javascript - Chrome uses that engine too.

Do you have a specific thing that does not work? I use javascript and I have seen some quite complex javascript being used as well, for example generation of charts and they have seemed to work good enough. The headers and footers often used with wkhtmltopdf rely heavily on javascipt as well.

I haven't used the ruby gem though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM