Hacker News new | past | comments | ask | show | jobs | submit login

This looks really well done. Any chance that it could emulate the functionality of wkhtmltopdf in the browser (a.k.a. CSS styling, structure from HTML)?



I would say pretty low wkhtmltopdf like PhantomJS uses Webkit to layout HTML then converts that layout to PDF, HTML layout including CSS and javascript execution is a heavy lift, this library only scratches the surface of what would be needed to cover wkhtmltopdf.

First you would need a pure js web browser, the closest thing currently being zombie I think. If you didn't care about running on the server then you could take advantage of the browser the lib is running in to get the current computed layout from the active dom and transform into the PDF layout, still a big job but the heavy lift is done by the browser. Telerik does this in their Kendo lib, where they render a active dom element to thier abstracted vector graphics model, then have PDF, SVG and Canvas renders for that: http://docs.telerik.com/kendo-ui/framework/drawing/drawing-d...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: