如何以漂亮的方式将网页转换为PDF格式[关闭]

I have a problem with converting a web page (web url) to pdf. Some of CSS and the JavaScript not showing as I want >,<.

I've try some open source code like:

  • dompdf
  • html2pdf.fr
  • html2pdf.it (which I've implement it)

The closest result as I want is html2pdf.it, but it's still not enough because some of CSS not showing correctly. Example html2pdf.it

When I try to open pdfcrowd.com, it's show the result what I want.Example pdfcrowd but we must paid for the service and the limitation problem.

I've tried to google and search how to make it prettier, but until know I still didn't got the answer yet. >,<

Is there any other open source similar with them, or other things that I can do for it? I like their concept using url so I can use it with my other web based application using the api or triggered the link.

You can use wkhtmltopdf its a very cool command line tool which makes a PDF from a website or a HTML file.

HTML to PDF is tricky. I've tried most open source solutions, and they usually fall short in some aspect. If you are willing to pay, I use docraptor.com, a very easy to use SaaS product with a reasonable price model(per month). Internally it uses Prince, which is a very powerful HTML to PDF library, supporting various CSS3 features.

I have no affiliation to Docraptor or PrinceXML, just a happy customer.