It has definitely been posted to HN numerous times in the past. However, it seems the reason it was posted again this time is because the jsPDF website had a major design revamp.
At least, it looks very different from when I last used it ~6 months ago.
Cannot get it to work for me. It shows only a blank page, both in the in-page viewer, and the saved document locally. I am on a linux Mint 15 and Firefox 23
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.
What 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.
For 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.)
We offer our database publishing software as open source (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.
The 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.
HTMLtoPDF 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 ?
The 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...
Looking at http://en.wikibooks.org/wiki/LaTeX/Tables I see that the column width needs to be specified to avoid text overflow. HTML does much better job, automatically fitting a table to desired width.
Yes 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.
The only thing that bothers be about LaTeX (or PDF readers?) is that I can't copy and paste cleanly from the document. Many glyphs get tied together, white space is lost, code doesn't come out cleanly, etc.
It's not as easy to lay things out nicely when you have things of an unknown length that could spread out to multiple pages with HTML as with pretty much any other method.
> 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.
It'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.
Previously hosted at JsPDF.Com. I'm not sure why it's moved, but I've used this library and can attest to its awesomeness. It seems really stable to me. I use it to create and print off 4 page employment applications.
Gotchas :
1 - It can be hard to get downloading working using the Flash shim (For IE9 and below). It is possible though.
2 - Images have to be Base64 encoded, and that can be a royal pain.
I'm not the worlds best developer by a long chalk, but I had this library wrapped in a reporting class in a couple of days, and I can now pretty easily just throw some JS Structures at it, and have the tabular data printed out with headers and footers. I wish I could share it.
It essentially allows you to make an HTML page and convert it to a PDF. It has powerful options around making footers, headers etc. The best part is you can run jQuery on it. It comes in handy when you don't know what the data will be like.
This is very interesting. Careful using only client-side technologies to generate PDFs though. What if down the line you get another user requirement, such as having a PDF generated and mailed to the user?
Assuming you are not using Node.js as a backend, that might pose a problem, and cause you to possibly maintain the logic for two separate PDF generators.
Slightly off-topic, Pdf and Ps are just plain outdated for today. They're unreadable on small screens and for people with bad eyesight, and no one sane prints stuff out these days Html is better, but the real thing today is tablet apps. All docs should be published as interactive 10/7/5 inch apps. Books should also disappear and be replaced by that form factor. Scientific paper authors also need to realize this and replace latex with app programming and publish their work as apps.
As far as I can tell no file viewer or eBook reader tries to make browsing through a large file as convenient as physical page flipping. Electronic reading does let you find specific phrases, or go to an exact page number but browsing is still very inconvenient.