5 ms·
This is pretty awesome, but I think something that could PDF an html page would be much more valuable. Currently I have to use some wkhtmltopdf server-side tric
by mikegioia 13y ago
This is pretty awesome, but I think something that could PDF an html page would be much more valuable. Currently I have to use some wkhtmltopdf server-side trickery.
- brianfryer 13y agoUse PhantomJS to Create PDFs from HTML: https://coderwall.com/p/5vmo1g https://coderwall.com/p/5vmo1g
- nlh 13y agoThank you for the lead - looks good. I found this, which goes into a bit more details for the Rails folks (like me): http://big-elephants.com/2012-12/pdf-rendering-with-phantomjs/ http://big-elephants.com/2012-12/pdf-rendering-with-phantomj... Looks very promising. Open to suggestions if others have better PDF-generating solutions!
- paulwithap 13y agoWhat they don't tell you is that this method takes a long time and generates huge files unless you used a patched version of qt. I've been meaning to write a blog post on this.
- pero 13y agoPlease do.
- paulwithap 13y agoWhat they don't tell you is that this method takes a long time and generates huge files unless you used a patched version of qt. I've been meaning to write a blog post on this.
- _sh 13y agoPhantomJS uses the same mechanism that wkhtmltopdf uses (headless webkit) and thus requires the 'server-side trickery' mentioned by the parent. Also, the correct link is http://phantomjs.org/ http://phantomjs.org/
- goldins 13y agoI've used PrinceXML in the past and it worked well: http://www.princexml.com/ http://www.princexml.com/
- mjn 13y agoFor use on the web you'll need a server license, though, which is $3800 for one machine. Fine if it's a business with revenue, but pretty steep for side projects or free services. (There's also a free version for non-commercial users, but it's really only usable for evaluation, because it adds a PrinceXML logo to the generated PDFs.)
- patrickg 13y agoWe offer our database publishing software as open source (http://speedata.github.io/publisher/index.html http://speedata.github.io/publisher/index.html). It is used in many commercial environments as a better alternative to XSL-FO. Our software allows much more flexible layouts. That said: english documentation is still behind and we are lacking nice show cases. If you need more info, just contact me.
- cju 13y agoIIRC it's one of the few big applications written with Mercury functional logic language.
- aeontech 13y agoLast time I had to generate pdf's, I just generated latex markup and then rendered it to pdf. You could look into something like http://prawn.majesticseacreature.com/ http://prawn.majesticseacreature.com/ though.
- DenisM 13y agoThe nice thing about HTML is that it does layout for you. If you have to generate PDF yourself you have to do the layout, in particular sizing tables is a huge pain...
- Argorak 13y agoLatex also does the layout for you. Thats the entire point :). Also, it is surprisingly fast.
- fudged71 13y agoIt's a new layout, though.
- omaranto 13y agoYes and one better suited for PDFs I would think: PDF files are a sequence of pages, and LaTeX pours a little effort into choosing page breaks, when I print HTML pages from a browser, the division into pages seems to done with the greedy algorithm.
- HarrietJones 13y agoThe version of this I used had basic HTML Rendering in it. I believe that the author (@mrRio) was going to do more on that. It looks, for the moment, that they've stopped mentioning the HTML rendering though, so maybe that was too tricky. Maybe the prior HTML rendering functions are still in the source. I think it's worth downloading and checking.
- gsnedders 13y agoAnother option is WeasyPrint — although it is rather slow.
- thejosh 13y agowkhtmltopdf to me is very unstable and crashes quite often. How have you found it?
- mikegioia 13y agoIt's been pretty flawless for me. I'm running the 64 bit 0.11.0 static RC1. Like another post said though, it's really a pain to handle page breaks, page numbers, headers/footers etc. But for straight HTML page -> PDF it's really good.
- lutusp 13y ago> Currently I have to use some wkhtmltopdf server-side trickery. I've used wkhtmltopdf, but lately I've discovered that Chrome does a pretty good job if you print a page, then specify print-to-file to a PDF destination.
- kayoone 13y agoHTMLtoPDF is so convenient until you need clean page breaks, page numbers, consistent header/footers etc..getting that right is extremely tedious with HTML so until now i always needed to revert back to a full blown (often expensive) PDF lib. Any1 has a better solution ?