pdftotext(1)
โจ pdftotext(1) โ the girlies' guide to turning PDFs into text โจ
okay bestie, sit down, hydrate, because today we're talking about pdftotext โ a member of the Xpdf general commands fam, and honestly? it's giving iconic. it's version 3.03, it converts Portable Document Format (PDF) files into plain text, and it has been carrying the entire "i need the words but not the vibes" industry on its back. ๐ซถ
๐ธ NAME ๐ธ
pdftotext โ Portable Document Format (PDF) to text converter (version 3.03). that's it, that's the whole name section, she's concise ๐
๐ SYNOPSIS ๐
pdftotext [options] PDF-file [text-file]
like... look at that. options, then the PDF, then where you want the text to go. simple. elegant. main character energy. ๐
๐ฆ DESCRIPTION ๐ฆ
so here's the tea: Pdftotext converts Portable Document Format (PDF) files to plain text. literally her whole job and she does it well.
she reads the PDF file, PDF-file, and writes a text file, text-file. that's the contract.
- if text-file is not specified, pdftotext converts
file.pdftofile.txt. automatic. no thoughts required. โจ - if text-file is
-, the text is sent to stdout โ so you can pipe it wherever like the icon you are. - if PDF-file is
-, it reads the PDF file from stdin. yes she does both. versatile queen ๐ง
๐ OPTIONS ๐
one bullet per flag, no skips, no shortcuts, we're doing the full list. buckle up bestie.
-fnumber โ specifies the first page to convert. start where you want to start.-lnumber โ specifies the last page to convert. end where you want to end.-rnumber โ specifies the resolution, in DPI. the default is 72 DPI. that's the lowkey important number, don't forget it.-xnumber โ specifies the x-coordinate of the crop area top left corner.-ynumber โ specifies the y-coordinate of the crop area top left corner.-Wnumber โ specifies the width of crop area in pixels (default is 0).-Hnumber โ specifies the height of crop area in pixels (default is 0).-layoutโ maintains (as best as possible) the original physical layout of the text. the default instead is to 'undo' physical layout โ columns, hyphenation, etc. โ and output the text in reading order. so-layoutis the "keep my columns pretty" girlie and default is the "just read it to me normally" girlie. ๐-fixednumber โ assume fixed-pitch (or tabular) text, with the specified character width (in points). this forces physical layout mode. no escape. ๐ฅ-rawโ keep the text in content stream order. this is described as a hack which often "undoes" column formatting, etc. and honestly? use of raw mode is no longer recommended. so like... technically it exists, but she's tired. ๐-remove-hyphensmode โ controls end-of-line hyphen handling. mode is one of:allโ remove end-of-line hyphens (U+002D,U+2010,U+FE63,U+FF0D) and Unicode soft hyphens (U+00AD), merging words across lines (default).softโ remove only Unicode soft hyphens (U+00AD), merging words across lines. ASCII and other hyphen characters are preserved.noneโ keep all end-of-line hyphens and line breaks unchanged.
heads up bestie: this option has no effect in-rawor-layoutmode. she simply will not hear you. ๐
-nodiagโ discard diagonal text (i.e., text that is not close to one of the 0, 90, 180, or 270 degree axes). this is useful for skipping watermarks drawn on body text. bye watermark ๐ โจ-htmlmetaโ generate a simple HTML file, including the meta information. this simply wraps the text in<pre>and</pre>and prepends the meta headers. it's basic but she's honest about it.-bboxโ generate an XHTML file containing bounding box information for each word in the file.-bbox-layoutโ generate an XHTML file containing bounding box information for each block, line, and word in the file. more detail, more drama.-tsvโ generate a TSV file containing the bounding box information for each block, line, and word in the file.-cropboxโ use the crop box rather than the media box with-bboxand-bbox-layout.-colspacingnumber โ specifies how much spacing we allow after a word before considering adjacent text to be a new column, measured as a fraction of the font size. current default is 0.7, old releases had a 0.3 default. glow-up fr fr ๐-encencoding-name โ sets the encoding to use for text output. this defaults to"UTF-8". as it should. ๐ง-listencโ lists the available encodings. go off, catalogue queen.-eolunix | dos | macโ sets the end-of-line convention to use for text output. pick your line-ending family.-nopgbrkโ don't insert page breaks (form feed characters) between pages. just one long stream, no interruptions. ๐-opwpassword โ specify the owner password for the PDF file. providing this will bypass all security restrictions. okay miss thing, use responsibly. ๐ฅ-upwpassword โ specify the user password for the PDF file.-qโ don't print any messages or errors. silence. blessed silence. ๐คซ-vโ print copyright and version information.-hโ print usage information. (and yup,-helpand--helpare equivalent, so you have options within your options ๐ )
๐ญ BUGS ๐ญ
and here's the sad part, bestie: some PDF files contain fonts whose encodings have been mangled beyond recognition. there is no way โ short of OCR โ to extract text from these files. she literally cannot do it. it's not a skill issue, it's a file issue. ๐
๐ EXIT CODES ๐
the Xpdf tools use the following exit codes:
0โ No error. ๐1โ Error opening a PDF file.2โ Error opening an output file.3โ Error related to PDF permissions.99โ Other error.
๐ AUTHOR ๐
the pdftotext software and documentation are copyright 1996-2011 Glyph & Cog, LLC. respect the elders, they built the house we live in. ๐ซถ
๐ SEE ALSO ๐
if you liked pdftotext, you will be obsessed with her siblings:
pdfdetach(1)pdffonts(1)pdfimages(1)pdfinfo(1)pdftocairo(1)pdftohtml(1)pdftoppm(1)pdftops(1)pdfseparate(1)pdfsig(1)pdfunite(1)
okay that's the whole page, no cap. this manual page is dated 15 August 2011 and exists under the pdftotext(1) banner โ so go forth, convert your PDFs, and slay. periodt. ๐ธโจ๐๐ฆ
๐ฆ where this page comes from
- ubuntu stonking: poppler-utils 26.07.0-2ubuntu1 ยท GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: poppler-utils 26.07.0-2ubuntu1.1 ยท GPL-2.0-only OR GPL-3.0-only
- Copyright 1997-2011 Glyph & Cog, LLC
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms