Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

While not quite as small as 3kb, I recently found this incredible library called html-to-image that's only 300kb. It clones whatever subtree of your document you want to a <foreignObject> inside an svg which then allows it to output canvas, png, svg, pdf, blob, jpeg, etc. Even more impressively is that it handles custom fonts, pseudo-elements, computed styles and more.

https://github.com/bubkoo/html-to-image

It's probably the most impressive and seamless experience I've had with converting HTML to pdfs/images so I just wanted to sing its praises here





It does sound very cool, but I don't think it exports to PDF: https://github.com/bubkoo/html-to-image/issues/327



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

Search: