LinuxCommandLibrary

pdftocairo

TLDR

Convert PDF to PNG

$ pdftocairo -png [document.pdf] [output_prefix]
copy
Convert PDF to SVG
$ pdftocairo -svg [document.pdf] [output.svg]
copy
Convert PDF to EPS
$ pdftocairo -eps [document.pdf] [output.eps]
copy
Convert specific page
$ pdftocairo -png -f [1] -l [1] [document.pdf] [output]
copy
Convert with resolution
$ pdftocairo -png -r [300] [document.pdf] [output]
copy
Convert to JPEG
$ pdftocairo -jpeg [document.pdf] [output]
copy
Scale to specific size
$ pdftocairo -png -scale-to [800] [document.pdf] [output]
copy

SYNOPSIS

pdftocairo [-png] [-svg] [-eps] [-pdf] [-r dpi] [-f first] [-l last] [options] input.pdf output

DESCRIPTION

pdftocairo converts PDF pages to various image and vector formats using the Cairo graphics library. It produces high-quality output suitable for print and web.
PNG output creates raster images at specified resolution. Higher DPI produces larger, more detailed images. Default is 150 DPI.
SVG output creates scalable vector graphics, preserving text and shapes. This is ideal for editing or embedding in web pages.
EPS output creates encapsulated PostScript for print workflows. It integrates with LaTeX and professional publishing tools.
Transparent backgrounds work with PNG for overlays and compositing. JPEG output is smaller but loses transparency.
Page range selection extracts specific pages. Combined with scripting, batch conversion of large documents is straightforward.

PARAMETERS

-png

Output as PNG.
-jpeg
Output as JPEG.
-tiff
Output as TIFF.
-svg
Output as SVG.
-eps
Output as EPS.
-ps
Output as PostScript.
-pdf
Output as PDF.
-r DPI
Resolution in DPI.
-f PAGE
First page.
-l PAGE
Last page.
-scale-to SIZE
Scale to pixel size.
-x N
X-offset.
-y N
Y-offset.
-W N
Width.
-H N
Height.
-transp
Transparent background.
-antialias MODE
Antialiasing (default, none, gray, subpixel).

CAVEATS

Vector output may have issues with complex fonts. Very high DPI uses significant memory. Some PDF features may not convert perfectly.

HISTORY

pdftocairo is part of poppler-utils and uses the Cairo graphics library. It provides higher-quality output than older rasterization tools by leveraging Cairo's sophisticated rendering.

SEE ALSO

Copied to clipboard