Skip to content

Instantly share code, notes, and snippets.

@rsms
Last active February 21, 2023 09:04
Show Gist options
  • Save rsms/dbe219ce99d1c61043e7803e168f5ca3 to your computer and use it in GitHub Desktop.
Save rsms/dbe219ce99d1c61043e7803e168f5ca3 to your computer and use it in GitHub Desktop.

Converting PDF → SVG

Surprisingly complicated. Figma supports SVG → PDF but not the other way around. Sketch supports PDF → SVG with some bugs (often vector shape overlaps are incorrect.)

dawbarton/pdf2svg looks like an interesting project that could be compiled as WASM but it is itself poinsoned by GNU GPL license. Plus, it depends on a huge amount of (also GPL-licensed) code in the form of Poppler and Cairo.

For a quick fix on macOS, install the Poppler CLI tools:

$ brew install poppler
$ pdftocairo -svg hello.pdf hello.svg

Mozilla's pdf.js could be used. Example: examples/node/pdf2svg.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment