Comment by freedomben

Comment by freedomben 2 days ago

4 replies

I'd love to go the other way: convert a PDF into a self contained HTML page that renders properly in a browser. It's been way harder than I thought it would. Any advice?

mr_mitm 2 days ago

You could embed it as a base64 blob, embed PDF.js (which is included by browsers anyway, I think) and use that to render it in the HTML. But I realize you probably meant a static HTML without JavaScript.

gucci-on-fleek a day ago

You can use dvisvgm, pdftocairo, or Inkscape to convert PDF to SVG, which you can either use directly or insert inline into an HTML document.

drabbiticus 2 days ago

> renders properly

Depending on your requirements on both PDF input and HTML output, there is often no way to do this that is both easy and general. At it's core, PDFs are not designed to be universally reflowable.