On this page

Get started

From installing to showing the first page in your app. Most people are done in about five minutes.

1. Pick how you'll use it

You only need one of these. Choose by where you want to call it from.

npm installs into your project's node_modules, pip into the active environment's site-packages, and cargo install puts docsvg in ~/.cargo/bin.

From the command line

For converting files in a terminal or a CI job. If you have Rust, install with cargo. If not, download the file for your system from the Releases page.

cargo install document-svg --locked

Node.js / TypeScript

For converting inside a web or Electron app. Type definitions are included.

npm install document-svg

Python

For converting inside scripts and data pipelines. Python 3.10 or newer.

python -m pip install document-svg

Rust

For building it into a Rust program.

cargo add document-svg

2. Convert your first file

The same conversion works the same way from anywhere. Each example runs as written.

Convert a file to SVG pagesbash

docsvg report.pdf --output output/report
docsvg slides.pptx --output output/slides
docsvg architecture.drawio --output output/diagram --stencils path/to/stencils.xml

Convert PDF pages in parallelbash

docsvg report.pdf --output output/report --jobs 4 --max-pages 100

Turn SVG pages back into PowerPoint, Word or other filesbash

docsvg reverse output/slides --output slides.pptx
docsvg reverse output/diagram --output diagram.drawio
docsvg reverse output/drawing --output drawing.dxf

Tidy up an existing SVG for where it will be usedbash

docsvg transform diagram.svg --output diagram.min.svg \
  --minify --monochrome "#1e293b" --responsive --precision 1

3. Check the result

Give it a new or empty output folder. Inside you get one SVG per page and one record of the conversion (conversion.json).

output/slides/
├── page-0001.svg
├── page-0002.svg
└── conversion.json
  • The record lists, as warnings, anything that could not be reproduced exactly.
  • Finishing without an error is not the same as perfect. If there are warnings, have a person look at the pages.
  • Even with no warnings, the pages are not guaranteed to match Office pixel for pixel. Text, for example, uses the fonts available where the SVG is viewed.

4. Show it in your app

Show each SVG as an image, for example with an image element. Don't paste the SVG's markup straight into your page's HTML.

The included display helpers do some basic checks, but they are not a filter that makes any SVG harmless.

5. Use it from tools you already have

GitHub Actions

Convert the documents a pull request changes, automatically.

Claude Code / Codex

Add it to your AI assistant as a plugin.

GitHub CLI

Use it as the gh docsvg command after running the installer in a local checkout.

6. If something goes wrong

  • Ready-made packages exist for Windows, macOS and Linux, on both x64 and ARM64.
  • Python on Alpine Linux has no ready-made package, so Rust and build tools are needed there.
  • If the npm package installs but won't load, check that optional dependencies were installed and that Node.js matches your machine's CPU. Copying node_modules to another system won't work.
  • The SVG pages display in current browsers, resvg, and librsvg 2.46 or newer.