开发者

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:

  1. Upload the zip via a form
  2. Unzip the contents
  3. Process the html file within using Hpricot or similar (if you need to tidy it up first)
  4. Convert the raw html to PDF with https://github.com/jdpace/PDFKit
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜