pdftoppm(1)

๐Ÿ“ฆ
version 26.10.0 ยท 3 versions
  • 26.10.0 ยท alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 21.01.0 ยท centos-stream 9
  • 4.06 ยท nixpkgs unstable
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

โœจ NAME โœจ

okay so this is pdftoppm(1) from the General Commands Manual ๐ŸŽ€ bestie, it's the tool that turns PDFs into images ๐Ÿ’–

pdftoppm - Portable Document Format (PDF) to Portable Pixmap (PPM) converter (version 3.03) ๐Ÿฆ‹

๐Ÿงš SYNOPSIS ๐Ÿงš

pdftoppm [options] PDF-file PPM-root

๐Ÿ’… DESCRIPTION ๐Ÿ’…

okay so pdftoppm converts PDF files into color images in PPM format ๐ŸŒˆ or grayscale images in PGM format ๐Ÿฉถ, or monochrome images in PBM format ๐Ÿ–ค. no cap, that's three slays in one โœจ

it reads the PDF file, PDF-file, and writes one PPM file per page, named PPM-root-number.ppm, where number is the page number ๐Ÿ“ if PDF-file is -, it reads the PDF straight from stdin, so you can pipe stuff in ๐Ÿซถ

๐ŸŒธ OPTIONS ๐ŸŒธ

  • -f number โ€” choose the first page to convert ๐Ÿ’–
  • -l number โ€” choose the last page to convert ๐Ÿ’–
  • -o โ€” only the odd numbered pages get generated ๐Ÿฆ‹
  • -e โ€” only the even numbered pages get generated ๐Ÿฆ‹
  • -singlefile โ€” writes just the first page and doesn't add digits to the name ๐ŸŽ€
  • -r number โ€” sets the X and Y resolution in DPI ๐Ÿ”ฅ the default is 150 DPI, lowkey perfect
  • -rx number โ€” sets just the X resolution in DPI ๐Ÿ”ฅ default is 150 DPI
  • -ry number โ€” sets just the Y resolution in DPI ๐Ÿ”ฅ default is 150 DPI
  • -scale-to number โ€” scales the long side of each page (width for landscape pages, height for portrait pages) to fit in number pixels โœจ the short side then follows the page's aspect ratio, so nothing gets squished ๐Ÿ™ˆ
  • -scale-to-x number โ€” scales each page horizontally to fit in number pixels โœจ if -scale-to-y is set to -1, the vertical size is worked out from the page's aspect ratio ๐Ÿงš
  • -scale-to-y number โ€” scales each page vertically to fit in number pixels โœจ if -scale-to-x is set to -1, the horizontal size is worked out from the aspect ratio ๐Ÿงš
  • -scale-dimension-before-rotation โ€” swaps the horizontal and vertical size for a rotated (landscape) PDF before scaling instead of after ๐Ÿ”„
  • -x number โ€” the x-coordinate of the crop area's top left corner ๐ŸŽฏ
  • -y number โ€” the y-coordinate of the crop area's top left corner ๐ŸŽฏ
  • -W number โ€” the width of the crop area in pixels (default is 0) ๐Ÿ“
  • -H number โ€” the height of the crop area in pixels (default is 0) ๐Ÿ“
  • -sz number โ€” the size of the crop square in pixels, and it sets both W and H ๐Ÿ“
  • -cropbox โ€” uses the crop box instead of the media box when making the files ๐Ÿ–ผ๏ธ
  • -hide-annotations โ€” annotations stay hidden ๐Ÿ™ˆ
  • -mono โ€” makes a monochrome PBM file instead of a color PPM file ๐Ÿ–ค
  • -gray โ€” makes a grayscale PGM file instead of a color PPM file ๐Ÿฉถ
  • -displayprofile displayprofilefile โ€” if poppler was built with colour management support, this sets the display profile to the ICC profile in displayprofilefile ๐ŸŽจ
  • -defaultgrayprofile defaultgrayprofilefile โ€” if poppler was built with colour management support, this sets the DefaultGray color space to the ICC profile in defaultgrayprofilefile ๐ŸŽจ
  • -defaultrgbprofile defaultrgbprofilefile โ€” if poppler was built with colour management support, this sets the DefaultRGB color space to the ICC profile in defaultrgbprofilefile ๐ŸŽจ
  • -defaultcmykprofile defaultcmykprofilefile โ€” if poppler was built with colour management support, this sets the DefaultCMYK color space to the ICC profile in defaultcmykprofilefile ๐ŸŽจ
  • -png โ€” makes a PNG file instead of a PPM file ๐ŸŒˆ
  • -jpeg โ€” makes a JPEG file instead of a PPM file ๐ŸŒˆ
  • -jpegopt jpeg-options โ€” used with -jpeg, this takes a list of options to control the JPEG compression ๐Ÿซถ see JPEG OPTIONS below for what's available
  • -tiff โ€” makes a TIFF file instead of a PPM file ๐ŸŒˆ
  • -tiffcompression none | packbits | jpeg | lzw | deflate โ€” picks the TIFF compression type ๐Ÿ—œ๏ธ it defaults to "none"
  • -freetype yes | no โ€” turns FreeType on or off (it's the TrueType / Type 1 font rasterizer) ๐Ÿ”ค it defaults to "yes"
  • -thinlinemode none | solid | shape โ€” sets the thin line mode ๐Ÿ“ it defaults to "none"
    • "solid" โ€” lines thinner than one pixel get snapped to the pixel boundary and painted one pixel wide ๐Ÿ“
    • "shape" โ€” lines thinner than one pixel get snapped to the pixel boundary and painted one pixel wide, but with a shape in proportion to their width ๐Ÿ“โœจ
  • -aa yes | no โ€” turns font anti-aliasing on or off ๐Ÿ–‹๏ธ it defaults to "yes"
  • -aaVector yes | no โ€” turns vector anti-aliasing on or off ๐Ÿ–‹๏ธ it defaults to "yes"
  • -opw password โ€” the owner password for the PDF ๐Ÿ”‘ giving this bypasses all security restrictions, so use it wisely ๐Ÿ‘‘
  • -upw password โ€” the user password for the PDF ๐Ÿ”‘
  • -q โ€” shh, no messages or errors get printed ๐Ÿคซ
  • -progress โ€” prints progress info as each page is generated ๐Ÿ“ˆ three space-separated fields go to STDERR: the number of the current page, the number of the last page that will be generated, and the path to the file written to
  • -sep char โ€” a single character separator between the name and the page number ๐Ÿงฉ default is -
  • -forcenum โ€” forces a page number even when there's only one page ๐Ÿ”ข
  • -v โ€” prints copyright and version info ๐Ÿ“œ
  • -h โ€” prints usage info ๐Ÿงพ (-help and --help do the exact same thing)

๐Ÿšฆ EXIT CODES ๐Ÿšฆ

okay so the Xpdf tools use these exit codes:

  • 0 โ€” no error, we slay ๐Ÿ’–
  • 1 โ€” error opening a PDF file ๐Ÿ’€
  • 2 โ€” error opening an output file ๐Ÿ’€
  • 3 โ€” error related to PDF permissions ๐Ÿ”’
  • 99 โ€” some other error ๐Ÿ’€

๐ŸŽ€ JPEG OPTIONS ๐ŸŽ€

when JPEG output is on, the -jpegopt option controls the JPEG compression parameters โœจ it takes a string of the form "<opt>=<val>[,<opt>=<val>]". right now these are the available options:

  • quality โ€” picks the JPEG quality value ๐ŸŽจ it has to be an integer between 0 and 100
  • progressive โ€” turns progressive JPEG output on or off ๐ŸŒŠ the possible values are "y" (progressive, yes) or "n" (non-progressive, no)
  • optimize โ€” decides whether to compute optimal Huffman coding tables for the JPEG output ๐Ÿง  this makes smaller files but makes an extra pass over the data ๐Ÿ™ˆ the value must be "y" or "n", with "y" doing the optimization, and otherwise the default Huffman tables get used

๐Ÿซถ AUTHOR ๐Ÿซถ

the pdftoppm software and documentation are copyright 1996-2011 Glyph & Cog, LLC ๐Ÿ“œ

๐Ÿ”— SEE ALSO ๐Ÿ”—

pdfdetach(1), pdffonts(1), pdfimages(1), pdfinfo(1), pdftocairo(1), pdftohtml(1), pdftops(1), pdftotext(1), pdfseparate(1), pdfsig(1), pdfunite(1) ๐Ÿ’œ


bestie, that's the whole pdftoppm(1) page ๐Ÿฆ‹ last updated 15 August 2011, so it's a little vintage, but still iconic ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from