convert html file(not html layout) into pdf using Rails
I have an application which takes in a zip file as its input. The zip file contains a html file, its css and the images. I need to开发者_Python百科 convert this html to pdf and send back. I have looked at Prince XML and wicked PDF but dont know how to perform this exact task.
It is like my application should act as a HTML to PDF converter. They will send us zip files and my app should generate the corresponding PDF. How to go about this task.
You can use PDFKit gem.
https://github.com/jdpace/PDFKit
http://www.jonathanspies.com/posts/11-Simple-PDFkit-example-in-Rails-3
The process I would implement is:
- Upload the zip via a form
- Unzip the contents
- Process the html file within using Hpricot or similar (if you need to tidy it up first)
- Convert the raw html to PDF with https://github.com/jdpace/PDFKit
精彩评论