Right now I'm using PhantomJS to render an HTML page. It supports styling via CSS, multiple pages, etc etc. What advantages does this have?
PhantomJS is a full web browser that just happens to output PDF's. This is a library to create PDF's with it's own layout model that shares nothing with HTML. Much simpler and low level.
Pdfmake – PDF printing in pure JavaScript
21–30 of 49 posts
Re: Pdfmake – PDF printing in pure JavaScript
#22Earlier quoted context omitted.
PhantomJS is a full web browser that just happens to output PDF's. This is a library to create PDF's with it's own layout model that shares nothing with HTML. Much simpler and low level.
Is it really simpler? I have to learn a DSL to create PDFs with this, whereas I can just use HTML in the other case.
Re: Pdfmake – PDF printing in pure JavaScript
#23Earlier quoted context omitted.
PhantomJS is a full web browser that just happens to output PDF's. This is a library to create PDF's with it's own layout model that shares nothing with HTML. Much simpler and low level.
Is it really simpler? I have to learn a DSL to create PDFs with this, whereas I can just use HTML in the other case.
A DSL designed for PDF creation is a much better way to approach this. It gives you way more control over what you're doing. Concerning pdfkit specifically, I think a JSON file is a gruesome way to design a PDF, but IMO it's still better than converting from HTML unless you're doing something very simple.
Re: Pdfmake – PDF printing in pure JavaScript
#24Re: Pdfmake – PDF printing in pure JavaScript
#25I use pdfkit because I have an offline-capable JS app with fairly rich document printing needs. A friendly layout engine on top can save a lot of effort making nice designs.
Re: Pdfmake – PDF printing in pure JavaScript
#26Just looked at the sample on the playground section of the website. No hyphenation, no ligatures, and overall the output looks ugly (compared to TeX). What is the advantage over simply creating an appropriate LaTeX/ConTeXt document in the background and serving that?
In my case, I have a Javascript app that stores critical information for offline use, and users want to be able to print that information nicely. So I generate PDFs in Javascript. This could make that much easier.
Re: Pdfmake – PDF printing in pure JavaScript
#27Re: Pdfmake – PDF printing in pure JavaScript
#28Little of topic. What would be nice is to have something like "print to pdf, aka save page as pdf" via a browser using pdfjs.
Re: Pdfmake – PDF printing in pure JavaScript
#29pdfmake is based on my PDFKit project http://github.com/devongovett/pdfkit , which does the actual PDF generation under the hood. pdfmake is a layout engine on top of PDFKit supporting a nice declarative json document description format.
Re: Pdfmake – PDF printing in pure JavaScript
#30Little of topic. What would be nice is to have something like "print to pdf, aka save page as pdf" via a browser using pdfjs.