← All articles 9 min read

Convert SVG to PDF: 5 Methods That Actually Work

SVG is the right format for vector graphics — logos, diagrams, icons, illustrations — because it scales to any size without losing sharpness. But when you need to share work with a client, prepare a print-ready file, or embed vector art in a document, PDF is what people actually ask for. It is device-independent, widely supported, and preserves vector paths perfectly without rasterizing.

The problem: SVG and PDF have different origins. SVG is a web standard; PDF is a print standard. Most image tools handle raster formats (PNG, JPG, WebP) and do not bridge this gap. Below are five methods that actually do.

Method Requires install? Quality Best for
Browser print to PDF No Good Quick one-off conversions
Inkscape 1.3 CLI Yes (free) Excellent Batch processing, print-ready output
rsvg-convert 2.58 Yes (free) Very good Lightweight scripting, Linux/macOS
Python cairosvg 2.7 Yes (free) Very good Python workflows, scripting
Node.js Puppeteer 22 Yes (free) Excellent Web dev pipelines, headless automation

Method 1 — Browser Print to PDF

No installs, no accounts, works on every OS. The browser renders the SVG exactly as it would on screen, then prints it to PDF via the OS virtual printer.

Steps

  1. Open your SVG file in a browser. The easiest way is to drag the .svg file onto a new browser tab in Chrome, Firefox, or Edge. The SVG renders immediately.
  2. Press Ctrl + P (Windows/Linux) or Cmd + P (macOS) to open the print dialog.
  3. Set the Destination (Chrome) or Printer (Firefox/Edge) to Save as PDF or Microsoft Print to PDF.
  4. Under More settings, set Paper size to match your intended output (A4 for most documents, Letter for US print). Set Margins to None if you want the SVG to fill the page edge-to-edge, or Default to preserve a small white border.
  5. Click Save and pick a destination.

What to watch for

When to use this: One-off conversions where you have a browser and no time to install anything. The quality is good enough for most sharing purposes.

Method 2 — Inkscape CLI (Best Quality)

Inkscape (GPL v2/v3 — free and open source) is the gold standard for SVG processing. Its command-line interface converts SVG to PDF with full vector fidelity, proper font handling, and support for advanced SVG features like gradients and filters.

Install Inkscape 1.3

# macOS (Homebrew)
brew install --cask inkscape

# Ubuntu/Debian
sudo apt-get install inkscape

# Windows — download installer from inkscape.org
# Verify installation:
inkscape --version
# Inkscape 1.3 (091e20e, 2023-07-28)

Convert a single SVG to PDF

inkscape --export-type=pdf --export-filename=output.pdf input.svg

Batch convert a directory

for f in *.svg; do
  inkscape --export-type=pdf --export-filename="${f%.svg}.pdf" "$f"
done

Set page size explicitly

By default, Inkscape uses the SVG's intrinsic dimensions. To force A4:

inkscape --export-type=pdf \
         --export-filename=output.pdf \
         --export-page-size=a4 \
         input.svg

Notes on Inkscape CLI flags

Inkscape 1.0 changed the CLI interface significantly. If you are on an older version (pre-1.0), the flags differ (-A output.pdf instead of --export-filename). Check your version with inkscape --version and consult the Inkscape 1.x man page if needed.

When to use this: Batch processing, print-ready PDFs, or any situation where quality matters. Inkscape handles complex SVGs — gradients, masks, clipping paths — better than any other open-source tool.

Method 3 — rsvg-convert (Lightweight CLI)

rsvg-convert is part of librsvg (LGPL v2.1 — free and open source), the SVG rendering library used by GNOME. It is much smaller than Inkscape and faster for scripted conversions.

Install rsvg-convert 2.58

# macOS (Homebrew)
brew install librsvg
# version installed: 2.58.x

# Ubuntu/Debian
sudo apt-get install librsvg2-bin

# Verify:
rsvg-convert --version
# rsvg-convert version 2.58.0

Convert SVG to PDF

rsvg-convert --format=pdf --output=output.pdf input.svg

Set explicit dimensions

# Scale to 210mm x 297mm (A4)
rsvg-convert --format=pdf \
             --width=794 --height=1123 \
             --output=output.pdf \
             input.svg

The width/height values above are A4 at 96 DPI (794 × 1123 px). Adjust for your target DPI — for 300 DPI print output, use --dpi-x=300 --dpi-y=300 instead.

rsvg-convert --format=pdf \
             --dpi-x=300 --dpi-y=300 \
             --output=output.pdf \
             input.svg

When to use this: Shell scripting on Linux or macOS where you want something lighter than Inkscape. Fast and reliable for standard SVGs. Does not handle all advanced SVG features (complex filters, some CSS properties) as gracefully as Inkscape.

Method 4 — Python with cairosvg

cairosvg (LGPL v3 — free and open source) is a Python library that converts SVG to PDF, PNG, and PS using the Cairo graphics library. Version 2.7.x is the current stable release.

Install cairosvg 2.7

pip install cairosvg==2.7.1

# Verify:
python3 -c "import cairosvg; print(cairosvg.__version__)"
# 2.7.1

On macOS, cairosvg requires Cairo and its dependencies:

brew install cairo pango gdk-pixbuf libffi
pip install cairosvg==2.7.1

Convert SVG to PDF

import cairosvg

cairosvg.svg2pdf(url="input.svg", write_to="output.pdf")

Convert from a string or bytes

svg_content = open("input.svg", "rb").read()
cairosvg.svg2pdf(bytestring=svg_content, write_to="output.pdf")

Set output size

# Force A4 at 300 DPI
cairosvg.svg2pdf(
    url="input.svg",
    write_to="output.pdf",
    output_width=2480,   # A4 at 300 DPI
    output_height=3508
)

Batch convert a directory

import cairosvg
from pathlib import Path

svg_dir = Path("./svgs")
pdf_dir = Path("./pdfs")
pdf_dir.mkdir(exist_ok=True)

for svg_file in svg_dir.glob("*.svg"):
    pdf_file = pdf_dir / svg_file.with_suffix(".pdf").name
    cairosvg.svg2pdf(url=str(svg_file), write_to=str(pdf_file))
    print(f"Converted: {svg_file.name} → {pdf_file.name}")

When to use this: Python workflows, data pipelines, or any situation where you want to generate PDFs programmatically from SVG templates. cairosvg is stable, well-documented, and handles most real-world SVGs correctly.

Method 5 — Node.js (Puppeteer)

Puppeteer (Apache 2.0 — free and open source) drives a headless Chromium instance. Since Chrome renders SVG with full fidelity (it is a browser standard, after all), Puppeteer produces the same output as Method 1 — but automated.

Install Puppeteer 22

npm install puppeteer@22.8.0

# Puppeteer downloads its own Chromium build (~170MB) on first install.
# If you want to use your system Chrome instead:
npm install puppeteer-core@22.8.0

Convert SVG to PDF

import puppeteer from 'puppeteer';
import path from 'path';
import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const browser = await puppeteer.launch();
const page = await browser.newPage();

// Load the SVG file directly
const svgPath = path.resolve(__dirname, 'input.svg');
await page.goto(`file://${svgPath}`, { waitUntil: 'networkidle0' });

await page.pdf({
  path: 'output.pdf',
  format: 'A4',
  printBackground: true,
  margin: { top: 0, right: 0, bottom: 0, left: 0 }
});

await browser.close();
console.log('Converted: input.svg → output.pdf');

Batch convert

import puppeteer from 'puppeteer';
import { glob } from 'glob';
import path from 'path';

const browser = await puppeteer.launch();
const page = await browser.newPage();

const files = await glob('svgs/*.svg');

for (const file of files) {
  const absPath = path.resolve(file);
  const outPath = file.replace('svgs/', 'pdfs/').replace('.svg', '.pdf');

  await page.goto(`file://${absPath}`, { waitUntil: 'networkidle0' });
  await page.pdf({ path: outPath, format: 'A4', printBackground: true });
  console.log(`Converted: ${file} → ${outPath}`);
}

await browser.close();

When to use this: Node.js build pipelines, design systems that generate PDF exports, or situations where you already use Puppeteer for other tasks. The output is identical to Chrome's print-to-PDF and handles modern CSS and web fonts correctly.

Alternative: svg2pdf.js

If you do not want a headless browser dependency, svg2pdf.js (MIT — free and open source) works entirely in Node.js using jsPDF:

npm install svg2pdf.js@2.2.3 jspdf@2.5.1

It is lighter than Puppeteer but has less complete SVG support — complex filters and some CSS properties may not render correctly.


Which Method Should You Use?

Situation Recommended method
One file, no tools installed Browser print to PDF (Method 1)
Best possible quality, complex SVGs Inkscape 1.3 CLI (Method 2)
Lightweight scripting on Linux/macOS rsvg-convert 2.58 (Method 3)
Python workflow or data pipeline cairosvg 2.7 (Method 4)
Node.js build pipeline Puppeteer 22 (Method 5)
Already using Puppeteer in your stack Puppeteer 22 (Method 5)
Simple SVG, minimal dependencies svg2pdf.js 2.2.3 (Method 5 alternative)

For most developers, Inkscape CLI (Method 2) is the most reliable choice for production use — it handles the widest range of SVG features and is available on all platforms. If you are in a Python environment, cairosvg (Method 4) is the natural fit. Browser print (Method 1) works for anything occasional.


FAQ

Can I convert SVG to PDF without losing quality?

Yes — SVG and PDF are both vector formats. All five methods above preserve vector paths natively, so the output PDF is sharp at any print size. Quality loss only happens if you accidentally rasterize the SVG first (e.g., export to PNG, then convert PNG to PDF). Avoid that path for logos, diagrams, and anything that will be printed large.

Why does my PDF have extra white space around the SVG?

The SVG's viewBox defines its intrinsic dimensions. If the viewBox is larger than the actual artwork, the white space is included. Fix this in your vector editor (Illustrator, Inkscape, Figma) by using File > Document Properties > Resize to Drawing (Inkscape) or Object > Artboards > Fit to Artwork (Illustrator) before exporting. Alternatively, trim the viewBox attribute manually in the SVG source.

Does Pixotter support SVG to PDF conversion?

No — Pixotter's /convert/ tool handles raster format conversions (PNG, JPG, WebP, AVIF) but does not convert SVG to PDF. For raster-to-PDF workflows, see the guides on converting PNG to PDF and converting images to PDF.

My SVG uses custom fonts — will they appear in the PDF?

It depends on the method. Browser print (Method 1) and Puppeteer (Method 5) use the browser's font rendering, so web fonts loaded via @font-face will render if the font files are accessible. Inkscape, rsvg-convert, and cairosvg rely on system fonts. If the font is not installed, they fall back to a substitute. The safest option for font-heavy SVGs: convert text to paths in your vector editor before running any conversion.

How do I convert multiple SVGs into a single multi-page PDF?

Inkscape handles this via its --export-type=pdf flag combined with multiple input files:

inkscape --export-type=pdf --export-filename=combined.pdf page1.svg page2.svg page3.svg

Alternatively, cairosvg can write multiple SVGs to a single PDF file by appending pages. The Puppeteer approach also works — call page.pdf() once per input SVG and merge the resulting PDFs with a library like pdf-lib.

Is there a difference between SVG to PDF and SVG to print-ready PDF?

For professional print (offset printing, large-format), "print-ready" means specific things: CMYK color space, embedded fonts, correct bleed marks, and compliance with PDF/X standards (PDF/X-4 is current). None of the free tools above produce PDF/X natively. For print-ready output, use Adobe Illustrator or Affinity Designer to export directly, or use Ghostscript to post-process the PDF with the appropriate profile.


If you need to work with SVG in other formats, or convert other image types to PDF, these guides cover the full workflow:

For raster image format conversions — PNG, JPG, WebP, AVIF — Pixotter's convert tool handles them instantly in your browser with no file uploads. If the resulting PDF is intended for web use (email attachments, website downloads), consider running the source image through Pixotter's compressor first to reduce file size without visible quality loss. Need to resize a rasterized version of your SVG? Use Pixotter's resize tool to hit exact pixel dimensions.