pdftocairo(1)

πŸ“¦
version 26.10.0 Β· 2 versions
  • 26.10.0 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 22.12.0 Β· centos-stream 9, debian bookworm, ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– pdftocairo(1) πŸ’–

Manual: pdftocairo(1), General Commands Manual 🌸

✨ NAME ✨

pdftocairo - Portable Document Format (PDF) to PNG/JPEG/TIFF/PDF/PS/EPS/SVG using cairo πŸ¦‹

πŸ“œ SYNOPSIS πŸ“œ

pdftocairo [options] PDF-file [output-file]

πŸŽ€ DESCRIPTION πŸŽ€

okay so pdftocairo is the tool that takes a Portable Document Format (PDF) file and turns it into basically whatever format you're craving πŸ’… It uses the cairo output device of the poppler PDF library to get the job done, and it can make any of these:

  • Portable Network Graphics (PNG) 🌈
  • JPEG Interchange Format (JPEG) πŸ“Έ
  • Tagged Image File Format (TIFF) πŸ–ΌοΈ
  • Portable Document Format (PDF) πŸ“„
  • PostScript (PS) πŸ“ 
  • Encapsulated PostScript (EPS) 🧚
  • Scalable Vector Graphics (SVG) ✨
  • Windows Printer πŸ–¨οΈ

so pdftocairo reads the PDF file, PDF-file, and writes to output-file. ngl the naming is kind of a vibe: the image formats (PNG, JPEG, and TIFF) make one file per page, and the page number and file type get tacked onto output-file πŸ”’ when you use -singlefile with the image formats, only the file type gets appended to output-file instead. but when the output is a vector format (PDF, PS, EPS, and SVG), output-file is the full filename, no extras πŸ™Œ

if the PDF-file is -, the PDF gets read from stdin 🫢 and if the output-file is -, the output gets written to stdout instead. using stdout is not valid with image formats unless you also use -singlefile πŸ™ˆ and if you skip output-file entirely, the output filename gets derived from the PDF-file filename, so no stress there πŸ’œ

not every option works with every output format, bestie, so be careful 🧐 you need one (and only one) of the output format options (-png, -jpeg, -tiff, -pdf, -print, -ps, -eps, or -svg). pick one, no double dipping πŸ’€

the resolution options (-r, -rx, -ry) set the resolution of the image output formats πŸ“ the image dimensions depend on the PDF page size and the resolution, so they go together like peanut butter and jelly πŸ₯ͺ for the vector outputs, any regions of the page that can't be represented natively in the output format (eg translucency in PS) get rasterized at the resolution you set with the resolution options 🌸

the -scale-to options let you set a fixed image size ✨ the image resolution will change depending on the page size, so it's a trade-off πŸ¦‹

the cropping options (-x, -y, -W, and -H) use pixels for the image formats and PostScript points (1/72 inch) for the vector formats πŸ“ when you crop vector output, the cropped region gets centered by default, unless you use -nocenter. in that case it sits at the top left (SVG) or bottom left (PDF, PS, EPS) instead 🧚

🌷 OPTIONS 🌷

  • -png β€” makes PNG file(s) 🌈
  • -jpeg β€” makes JPEG file(s). also check out -jpegopt πŸ“Έ
  • -tiff β€” makes TIFF file(s) πŸ–ΌοΈ
  • -pdf β€” makes a PDF file πŸ“„
  • -ps β€” makes a PS file πŸ“ 
  • -eps β€” makes an EPS file 🧚 heads up, an EPS file only holds a single image, so if you use this with a multi-page PDF, you have to use -f and -l to pick a single page. also, the page size options (-origpagesizes, -paper, -paperw, -paperh) can not be used with this one πŸ™…β€β™€οΈ
  • -svg β€” makes an SVG (Scalable Vector Graphics) file ✨
  • -print β€” (Windows only) sends it to a system printer πŸ–¨οΈ also see -printer and -printeropt.
    • if you don't specify an output file, the output goes straight to the printer 🫢
    • > the output file - can not be used with this option. don't even try it, bestie πŸ’€
  • -printdlg β€” (Windows only) also prints to a system printer, but first it pops up the print dialog so you can tweak the print options before sending anything πŸŽ€
  • -f number β€” picks the first page to convert πŸ₯‡
  • -l number β€” picks the last page to convert 🏁
  • -o β€” only makes the odd numbered pages 1️⃣
  • -e β€” only makes the even numbered pages 2️⃣
  • -singlefile β€” writes only the first page and skips adding digits to the filename 🫧
  • -r number β€” sets the X and Y resolution, in pixels per inch for image files (or for the rasterized regions in vector output) πŸ“ the default is 150 PPI πŸ’…
  • -rx number β€” sets just the X resolution, in pixels per inch for image files (or rasterized regions in vector output) πŸ“ the default is 150 PPI ✨
  • -ry number β€” sets just the Y resolution, in pixels per inch for image files (or rasterized regions in vector output) πŸ“ the default is 150 PPI 🌸
  • -scale-to number β€” scales the long side of each page (width for landscape pages, height for portrait pages) so it fits in number pixels πŸ¦‹ the short side gets sized by the page's aspect ratio (PNG/JPEG/TIFF only) πŸ–ΌοΈ
  • -scale-to-x number β€” scales each page horizontally so it fits in number pixels wide πŸ’œ if scale-to-y is set to -1, the vertical size gets figured out from the page's aspect ratio (PNG/JPEG/TIFF only) πŸ“
  • -scale-to-y number β€” scales each page vertically so it fits in number pixels tall πŸ’œ if scale-to-x is set to -1, the horizontal size gets figured out from the page's aspect ratio (PNG/JPEG/TIFF only) πŸ“
  • -x number β€” the x-coordinate of the top left corner of the crop area, in pixels (image output) or points (vector output) βœ‚οΈ
  • -y number β€” the y-coordinate of the top left corner of the crop area, in pixels (image output) or points (vector output) βœ‚οΈ
  • -W number β€” the width of the crop area, in pixels (image output) or points (vector output). default is 0 πŸŽ€
  • -H number β€” the height of the crop area, in pixels (image output) or points (vector output). default is 0 πŸŽ€
  • -sz number β€” the size of a square crop, in pixels (image output) or points (vector output). this one sets both -W and -H for you 🫢
  • -cropbox β€” uses the crop box instead of the media box when generating the files (PNG/JPEG/TIFF only) πŸ–ΌοΈ
  • -mono β€” makes a monochrome file (PNG and TIFF only) ⚫
  • -gray β€” makes a grayscale file (PNG, JPEG, and TIFF only) 🩢
  • -antialias β€” sets the cairo antialias option used for text and drawing in image files (or rasterized regions in vector output) 🫧 the options are:
    • default β€” uses the default antialiasing for the target device. this is what you get if you skip -antialias altogether πŸ’…
    • none β€” antialiasing is turned off πŸ™…β€β™€οΈ
    • gray β€” does single-color antialiasing using shades of gray 🩢
    • subpixel β€” does antialiasing by taking advantage of the order of subpixel elements on devices like LCDs πŸ“±
    • fast β€” hints that the backend should do some antialiasing but prefers speed over quality 🏎️
    • good β€” the backend should balance quality against performance βš–οΈ
    • best β€” hints that the backend should render at the highest quality, even if it costs speed πŸ‘‘
  • -transp β€” uses a transparent page color instead of white (PNG and TIFF only) 🫧
  • -icc icc-file β€” uses the specified ICC file as the output profile (PNG only) 🌈 the profile gets embedded right into the PNG file πŸ’–
  • -jpegopt jpeg-options β€” when used with -jpeg, takes a list of options that control the JPEG compression πŸŽ›οΈ see JPEG OPTIONS for the available options πŸ“Έ

✨ JPEG OPTIONS ✨

okay so when you're outputting JPEG, you can use -jpegopt to tweak the compression settings 🫢 it takes a string that looks like "<opt>=<val>[,<opt>=<val>]", and right now there are three options you can play with πŸ’…

  • quality β€” this one picks your JPEG quality. The value has to be a whole number from 0 to 100 πŸ“Έ
  • progressive β€” turns progressive JPEG output on or off. You give it y for yes or n for no 🌊
  • optimize β€” tells it whether to work out the best Huffman coding tables for your JPEG. Your file ends up smaller, but it has to make an extra pass over the data, so it's a little slower 🐒 Use y to optimize. Anything else (so, n) and it just sticks with the default Huffman tables 🧚

✨ WINDOWS PRINTER OPTIONS ✨

on Windows, you can skip the file step entirely and send the output straight to a system printer with -print πŸ–¨οΈ and if you want to fine-tune how it prints, -printopt is your bestie. It takes a string that looks like "<opt>=<val>[,<opt>=<val>]", and these are the options you can use:

  • source β€” picks which paper tray (bin) you want. You can choose upper, onlyone, lower, middle, manual, envelope, envmanual, auto, tractor, smallfmt, largefmt, largecapacity, or formsource. Or, if you want something driver-specific, just give it a number πŸŽ€
  • duplex β€” sets the duplex mode, aka whether it prints on both sides πŸ“„ You can choose off (no duplexing), short (short-edge binding), or long (long-edge binding) 🌈 Also, the general -duplex flag is basically the same thing as duplex=long. But if you use both, -printopt wins, no debate πŸ‘‘

✨ AUTHOR ✨

the pdftocairo software and its docs are copyright 1996-2004 Glyph & Cog, LLC, and copyright 2005-2011 The Poppler Developers πŸ’œ

✨ SEE ALSO ✨

literally go check these out if you want more πŸ¦‹ pdfdetach(1), pdffonts(1), pdfimages(1), pdfinfo(1), pdftohtml(1), pdftoppm(1), pdftops(1), pdftotext(1), pdfseparate(1), pdfsig(1), and pdfunite(1) 🧚


bestie, that's the whole page πŸ’– you're officially a pdftocairo(1) girlie now 🌸 stay iconic, and I'll see you in the next chat 🫢✨

πŸ“¦ where this page comes from