pdf2txt - Man Page

pdf2txt – extract text and images from PDF

Synopsis

pdf2txt [-h] [--version] [--debug] [--disable-caching] [--page-numbers PAGE_NUMBERS [PAGE_NUMBERS ...]] [--pagenos PAGENOS] [--maxpages MAXPAGES] [--password PASSWORD] [--rotation ROTATION] [--no-laparams] [--detect-vertical] [--char-margin CHAR_MARGIN] [--word-margin WORD_MARGIN] [--line-margin LINE_MARGIN] [--boxes-flow BOXES_FLOW] [--all-texts] [--outfile OUTFILE] [--output_type OUTPUT_TYPE] [--codec CODEC] [--output_dir OUTPUT_DIR] [--layoutmode LAYOUTMODE] [--scale SCALE] [--strip-control] files [files ...]

Description

A command line tool for extracting text and images from PDF and output it to plain text, html, xml or tags.

Options

Positional Arguments

files

One or more paths to PDF files.

Optional Arguments

-h--help

Show a help message and exit.

--version-v

Show program’s version number and exit.

--debug-d

Use debug logging level.

--disable-caching-C

If caching of resources, such as fonts, should be disabled.

Parser

Used during PDF parsing

--page-numbers PAGE_NUMBERS [PAGE_NUMBERS ...]

A space-seperated list of page numbers to parse.

--pagenos PAGENOS-p PAGENOS

A comma-separated list of page numbers to parse. Included for legacy applications; use --page-numbers for more idiomatic argument entry.

--maxpages MAXPAGES-m MAXPAGES

The maximum number of pages to parse.

--password PASSWORD-P PASSWORD

The password to use for decrypting PDF file.

--rotation ROTATION-R ROTATION

The number of degrees to rotate the PDF before other types of processing.

Layout Analysis

Used during layout analysis.

--no-laparams-n

If layout analysis parameters should be ignored.

--detect-vertical-V

If vertical text should be considered during layout analysis

--char-margin CHAR_MARGIN-M CHAR_MARGIN

If two characters are closer together than this margin they are considered to be part of the same line. The margin is specified relative to the width of the character.

--word-margin WORD_MARGIN-W WORD_MARGIN

If two characters on the same line are further apart than this margin then they are considered to be two separate words, and an intermediate space will be added for readability. The margin is specified relative to the width of the character.

--line-margin LINE_MARGIN-L LINE_MARGIN

If two lines are are close together they are considered to be part of the same paragraph. The margin is specified relative to the height of a line.

--boxes-flow BOXES_FLOW-F BOXES_FLOW

Specifies how much a horizontal and vertical position of a text matters when determining the order of lines. The value should be within the range of -1.0 (only horizontal position matters) to +1.0 (only vertical position matters). You can also pass None to disable advanced layout analysis, and instead return text based on the position of the bottom left corner of the text box.

--all-texts-A

If layout analysis should be performed on text in figures.

Output

Used during output generation.

--outfile OUTFILE-o OUTFILE

Path to file where output is written. Or “-” (default) to write to stdout.

--output_type OUTPUT_TYPE-t OUTPUT_TYPE

Type of output to generate {text,html,xml,tag}.

--codec CODEC-c CODEC

Text encoding to use in output file.

--output-dir OUTPUT_DIR-O OUTPUT_DIR

The output directory to put extracted images in. If not given, images are not extracted.

--layoutmode LAYOUTMODE-Y LAYOUTMODE

Type of layout to use when generating html {normal,exact,loose}. If normal, each line is positioned separately in the html. If exact, each character is positioned separately in the html. If loose, same result as normal but with an additional newline after each text line. Only used when output_type is html.

--scale SCALE-s SCALE

The amount of zoom to use when generating html file. Only used when output_type is html.

--strip-control-S

Remove control statement from text. Only used when output_type is xml.

See Also

dumppdf(1)

Referenced By

dumppdf(1).

October 2021