Debian Codegraph @

libs/xpdf/xpdf-src/doc/pdftotext.cat

raw
1 pdftotext(1) General Commands Manual pdftotext(1)
2
3
4
5 NAME
6 pdftotext - Portable Document Format (PDF) to text converter (version
7 4.06)
8
9 SYNOPSIS
10 pdftotext [options] [PDF-file [text-file]]
11
12 DESCRIPTION
13 Pdftotext converts Portable Document Format (PDF) files to plain text.
14
15 Pdftotext reads the PDF file, PDF-file, and writes a text file, text-
16 file. If text-file is not specified, pdftotext converts file.pdf to
17 file.txt. If text-file is '-', the text is sent to stdout.
18
19 CONFIGURATION FILE
20 Pdftotext reads a configuration file at startup. It first tries to
21 find the user's private config file, ~/.xpdfrc. If that doesn't exist,
22 it looks for a system-wide config file, typically /etc/xpdfrc (but this
23 location can be changed when pdftotext is built). See the xpdfrc(5)
24 man page for details.
25
26 OPTIONS
27 Many of the following options can be set with configuration file com-
28 mands. These are listed in square brackets with the description of the
29 corresponding command line option.
30
31 -f number
32 Specifies the first page to convert.
33
34 -l number
35 Specifies the last page to convert.
36
37 -layout
38 Maintain (as best as possible) the original physical layout of
39 the text. The default is to 'undo' physical layout (columns,
40 hyphenation, etc.) and output the text in reading order. If the
41 -fixed option is given, character spacing within each line will
42 be determined by the specified character pitch.
43
44 -simple
45 Similar to -layout, but optimized for simple one-column pages.
46 This mode will do a better job of maintaining horizontal spac-
47 ing, but it will only work properly with a single column of
48 text.
49
50 -simple2
51 Similar to -simple, but handles slightly rotated text (e.g., OCR
52 output) better. Only works for pages with a single column of
53 text.
54
55 -table Table mode is similar to physical layout mode, but optimized for
56 tabular data, with the goal of keeping rows and columns aligned
57 (at the expense of inserting extra whitespace). If the -fixed
58 option is given, character spacing within each line will be de-
59 termined by the specified character pitch.
60
61 -lineprinter
62 Line printer mode uses a strict fixed-character-pitch and
63 -height layout. That is, the page is broken into a grid, and
64 characters are placed into that grid. If the grid spacing is
65 too small for the actual characters, the result is extra white-
66 space. If the grid spacing is too large, the result is missing
67 whitespace. The grid spacing can be specified using the -fixed
68 and -linespacing options. If one or both are not given on the
69 command line, pdftotext will attempt to compute appropriate
70 value(s).
71
72 -raw Keep the text in content stream order. Depending on how the PDF
73 file was generated, this may or may not be useful.
74
75 -fixed number
76 Specify the character pitch (character width), in points, for
77 physical layout, table, or line printer mode. This is ignored
78 in all other modes.
79
80 -linespacing number
81 Specify the line spacing, in points, for line printer mode.
82 This is ignored in all other modes.
83
84 -clip Text which is hidden because of clipping is removed before doing
85 layout, and then added back in. This can be helpful for tables
86 where clipped (invisible) text would overlap the next column.
87
88 -nodiag
89 Diagonal text, i.e., text that is not close to one of the 0, 90,
90 180, or 270 degree axes, is discarded. This is useful to skip
91 watermarks drawn on top of body text, etc.
92
93 -enc encoding-name
94 Sets the encoding to use for text output. The encoding-name
95 must be defined with the unicodeMap command (see xpdfrc(5)).
96 The encoding name is case-sensitive. This defaults to "Latin1"
97 (which is a built-in encoding). [config file: textEncoding]
98
99 -eol unix | dos | mac
100 Sets the end-of-line convention to use for text output. [config
101 file: textEOL]
102
103 -nopgbrk
104 Don't insert a page breaks (form feed character) at the end of
105 each page. [config file: textPageBreaks]
106
107 -bom Insert a Unicode byte order marker (BOM) at the start of the
108 text output.
109
110 -marginl number
111 Specifies the left margin, in points. Text in the left margin
112 (i.e., within that many points of the left edge of the page) is
113 discarded. The default value is zero.
114
115 -marginr number
116 Specifies the right margin, in points. Text in the right margin
117 (i.e., within that many points of the right edge of the page) is
118 discarded. The default value is zero.
119
120 -margint number
121 Specifies the top margin, in points. Text in the top margin
122 (i.e., within that many points of the top edge of the page) is
123 discarded. The default value is zero.
124
125 -marginb number
126 Specifies the bottom margin, in points. Text in the bottom mar-
127 gin (i.e., within that many points of the bottom edge of the
128 page) is discarded. The default value is zero.
129
130 -opw password
131 Specify the owner password for the PDF file. Providing this
132 will bypass all security restrictions.
133
134 -upw password
135 Specify the user password for the PDF file.
136
137 -verbose
138 Print a status message (to stdout) before processing each page.
139 [config file: printStatusInfo]
140
141 -q Don't print any messages or errors. [config file: errQuiet]
142
143 -cfg config-file
144 Read config-file in place of ~/.xpdfrc or the system-wide config
145 file.
146
147 -listencodings
148 List all available text output encodings, then exit.
149
150 -v Print copyright and version information, then exit.
151
152 -h Print usage information, then exit. (-help and --help are
153 equivalent.)
154
155 BUGS
156 Some PDF files contain fonts whose encodings have been mangled beyond
157 recognition. There is no way (short of OCR) to extract text from these
158 files.
159
160 EXIT CODES
161 The Xpdf tools use the following exit codes:
162
163 0 No error.
164
165 1 Error opening a PDF file.
166
167 2 Error opening an output file.
168
169 3 Error related to PDF permissions.
170
171 98 Out of memory.
172
173 99 Other error.
174
175 AUTHOR
176 The pdftotext software and documentation are copyright 1996-2025 Glyph
177 & Cog, LLC.
178
179 SEE ALSO
180 xpdf(1), pdftops(1), pdftohtml(1), pdfinfo(1), pdffonts(1), pdfde-
181 tach(1), pdftoppm(1), pdftopng(1), pdfimages(1), xpdfrc(5)
182 http://www.xpdfreader.com/
183
184
185
186 14 Nov 2025 pdftotext(1)