jussiniinikoski / wasm-pdf

Generate PDF files with JavaScript and WASM (WebAssembly)
Apache License 2.0
479 stars 51 forks source link

HTML support #3

Open DanielJackson-Oslo opened 4 years ago

DanielJackson-Oslo commented 4 years ago

Hi!

Have you attempted integrating something like https://wkhtmltopdf.org/ for full HTML support?

jussiniinikoski commented 4 years ago

No I haven't, JSON is currently somewhat easier format to structure around. We could try to have some inline elements like anchors or other formatting tags in Paragraph elements..

DanielJackson-Oslo commented 4 years ago

I did some research, and seems like wkhtmltopdf and all other html + css readers are too complex for wasm, as f.ex. wkthmltopdf includes all of Qt. :(

DanielJackson-Oslo commented 4 years ago

My usecase is to generate PDFs from HTML emails. Easy to do backend, but I'd like to do it client side for privacy and security reasons.

jussiniinikoski commented 4 years ago

If you need to reproduce the actual appearance of the email, then it will be pretty difficult at the moment. You'd essentially need a browser in browser to provide layout, styles etc.

But if all emails look the same then you could propably "hardcode" styling into WASM output..

llamadeus commented 1 year ago

@DanielJackson-Oslo I'm trying to do something similar. This is a great project. I really like the idea of implementing a pdf library in Rust for WASM and I really appreciate your effort @jussiniinikoski, but IMHO pdfmake seems like the next best option.

niutech commented 1 year ago

If Qt apps, QML browser or PC emulators can run in WASM, why couldn't a headless web engine be ported to WASM? Maybe port litehtml or lexbor to WASM and integrate with WASM-PDF?