PDF2TXT(1)
β¨ PDF2TXT β¨
okay bestie, gather round π this is pdf2txt, the User Commands girlie who walks into your PDFs and walks out with the actual text and images. she does not gatekeep, she extracts. periodt.
πΈ NAME πΈ
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 π
so basically it's a command line tool that pulls text and images out of a PDF, and then outputs all of that as plain text, html, xml or tags. no cap, that's the whole job and she eats every time π
β¨ OPTIONS β¨
π«Ά POSITIONAL ARGUMENTS
filesβ one or more paths to PDF files. (yes, plural, she's greedy in a cute way, give her all of them)
π OPTIONAL ARGUMENTS
-h,--helpβ show a help message and exit. your little tutorial era π§--version,-vβ show the program's version number and exit. main character introduction.--debug,-dβ use debug logging level. she will literally tell you everything that's happening π--disable-caching,-Cβ if caching of resources, such as fonts, should be disabled.
π PARSER
used during PDF parsing β this is the part where she actually reads the file, bestie π₯
--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. this one is included for legacy applications; use--page-numbersfor more idiomatic argument entry. (iykyk β old habits die hard π)--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 β aka her figuring out which squiggles belong together π
--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 passNoneto disable advanced layout analysis, and instead return text based on the position of the bottom left corner of the text box.
lowkey the-1.0to+1.0range is not a suggestion bestie, stay inside it π
--all-texts,-Aβ if layout analysis should be performed on text in figures.
π OUTPUT
used during output generation β the glow-up phase, where it all becomes something you can actually read β¨
--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. (no dir, no pics, that's the deal π)--layoutmode LAYOUTMODE,-Y LAYOUTMODEβ type of layout to use when generating html{normal,exact,loose}. ifnormal, each line is positioned separately in the html. ifexact, each character is positioned separately in the html. ifloose, same result asnormalbut with an additional newline after each text line. only used whenoutput_typeishtml.--scale SCALE,-s SCALEβ the amount of zoom to use when generating html file. only used whenoutput_typeishtml.--strip-control,-Sβ remove control statement from text. only used whenoutput_typeisxml.
π SEE ALSO π
dumppdf(1) β her sibling, also iconic, also doing the most π
and that's the whole page, bestie π this vibe check was brought to you by the October 2021 edition of PDF2TXT(1) β go forth, extract, slay π¦πβ¨
π¦ where this page comes from
- epel 10: python3-pdfminer 20251230-1.el10_2 Β· MIT AND LicenseRef-Fedora-Public-Domain AND APAFML AND BSD-3-Clause AND (Apache-2.0 AND MIT) AND Adobe-Glyph
- epel 9: python3-pdfminer 20240706-4.el9 Β· MIT AND LicenseRef-Fedora-Public-Domain AND APAFML AND BSD-3-Clause AND (Apache-2.0 AND MIT) AND Adobe-Glyph
- fedora 43: python3-pdfminer 20250506-5.fc43 Β· MIT AND LicenseRef-Fedora-Public-Domain AND APAFML AND BSD-3-Clause AND (Apache-2.0 AND MIT) AND Adobe-Glyph
- fedora 43: python3-pdfminer 20260107-1.fc43 Β· MIT AND LicenseRef-Fedora-Public-Domain AND APAFML AND BSD-3-Clause AND (Apache-2.0 AND MIT) AND Adobe-Glyph
- fedora 44: python3-pdfminer 20260107-2.fc44 Β· MIT AND LicenseRef-Fedora-Public-Domain AND APAFML AND BSD-3-Clause AND (Apache-2.0 AND MIT) AND Adobe-Glyph
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms