Remix.run Logo
freedomben a day ago

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 a day ago | parent | next [-]

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.

freedomben a day ago | parent [-]

Yes ideally, but even this is helpful, thank you!

gucci-on-fleek 20 hours ago | parent | prev | next [-]

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 a day ago | parent | prev [-]

> 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.