{
    "mode": "man",
    "parameter": "pdftotext",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/pdftotext/1/json",
    "generated": "2026-06-03T03:33:56Z",
    "synopsis": "pdftotext [options] [PDF-file [text-file]]",
    "sections": {
        "NAME": {
            "content": "pdftotext - Portable Document Format (PDF) to text converter (version 3.03)\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "pdftotext [options] [PDF-file [text-file]]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Pdftotext converts Portable Document Format (PDF) files to plain text.\n\nPdftotext  reads  the PDF file, PDF-file, and writes a text file, text-file.  If text-file is\nnot specified, pdftotext converts file.pdf to file.txt.  If text-file is  ´-',  the  text  is\nsent to stdout.  If PDF-file is ´-', it reads the PDF file from stdin.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-f",
                    "content": "Specifies the first page to convert.\n",
                    "flag": "-f"
                },
                {
                    "name": "-l",
                    "content": "Specifies the last page to convert.\n",
                    "flag": "-l"
                },
                {
                    "name": "-r",
                    "content": "Specifies the resolution, in DPI.  The default is 72 DPI.\n",
                    "flag": "-r"
                },
                {
                    "name": "-x",
                    "content": "Specifies the x-coordinate of the crop area top left corner\n",
                    "flag": "-x"
                },
                {
                    "name": "-y",
                    "content": "Specifies the y-coordinate of the crop area top left corner\n",
                    "flag": "-y"
                },
                {
                    "name": "-W",
                    "content": "Specifies the width of crop area in pixels (default is 0)\n",
                    "flag": "-W"
                },
                {
                    "name": "-H",
                    "content": "Specifies the height of crop area in pixels (default is 0)\n",
                    "flag": "-H"
                },
                {
                    "name": "-layout",
                    "content": "Maintain  (as best as possible) the original physical layout of the text.  The default\nis to ´undo' physical layout (columns, hyphenation, etc.) and output the text in read‐\ning order.\n"
                },
                {
                    "name": "-fixed",
                    "content": "Assume  fixed-pitch (or tabular) text, with the specified character width (in points).\nThis forces physical layout mode.\n"
                },
                {
                    "name": "-raw",
                    "content": "formatting, etc.  Use of raw mode is no longer recommended.\n"
                },
                {
                    "name": "-nodiag",
                    "content": "Discard  diagonal  text (i.e., text that is not close to one of the 0, 90, 180, or 270\ndegree axes). This is useful for skipping watermarks drawn on body text.\n"
                },
                {
                    "name": "-htmlmeta",
                    "content": "Generate a simple HTML file, including the meta information.  This  simply  wraps  the\ntext in <pre> and </pre> and prepends the meta headers.\n"
                },
                {
                    "name": "-bbox",
                    "content": ""
                },
                {
                    "name": "-bbox-layout",
                    "content": "Generate  an  XHTML file containing bounding box information for each block, line, and\nword in the file.\n"
                },
                {
                    "name": "-cropbox",
                    "content": "Use the crop box rather than the media box with -bbox and -bbox-layout.\n"
                },
                {
                    "name": "-colspacing",
                    "content": "Specifies how much spacing we allow after a word before considering adjacent  text  to\nbe  a new column, measured as a fraction of the font size. Current default is 0.7, old\nreleases had a 0.3 default.\n"
                },
                {
                    "name": "-enc",
                    "content": "Sets the encoding to use for text output. This defaults to \"UTF-8\".\n"
                },
                {
                    "name": "-listenc",
                    "content": "Lists the available encodings\n"
                },
                {
                    "name": "-eol",
                    "content": "Sets the end-of-line convention to use for text output.\n"
                },
                {
                    "name": "-nopgbrk",
                    "content": "Don't insert page breaks (form feed characters) between pages.\n"
                },
                {
                    "name": "-opw",
                    "content": "Specify the owner password for the PDF file.  Providing this will bypass all  security\nrestrictions.\n"
                },
                {
                    "name": "-upw",
                    "content": "Specify the user password for the PDF file.\n"
                },
                {
                    "name": "-q",
                    "content": "",
                    "flag": "-q"
                },
                {
                    "name": "-v",
                    "content": "",
                    "flag": "-v"
                },
                {
                    "name": "-h -help --help",
                    "content": "",
                    "flag": "-h",
                    "long": "--help"
                }
            ]
        },
        "BUGS": {
            "content": "Some  PDF files contain fonts whose encodings have been mangled beyond recognition.  There is\nno way (short of OCR) to extract text from these files.\n",
            "subsections": []
        },
        "EXIT CODES": {
            "content": "The Xpdf tools use the following exit codes:\n\n0      No error.\n\n1      Error opening a PDF file.\n\n2      Error opening an output file.\n\n3      Error related to PDF permissions.\n\n99     Other error.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "The pdftotext software and documentation are copyright 1996-2011 Glyph & Cog, LLC.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "pdfdetach(1),   pdffonts(1),   pdfimages(1),   pdfinfo(1),    pdftocairo(1),    pdftohtml(1),\npdftoppm(1), pdftops(1), pdfseparate(1), pdfsig(1), pdfunite(1)\n\n\n\n15 August 2011                               pdftotext(1)",
            "subsections": []
        }
    },
    "summary": "pdftotext - Portable Document Format (PDF) to text converter (version 3.03)",
    "flags": [
        {
            "flag": "-f",
            "long": null,
            "arg": null,
            "description": "Specifies the first page to convert."
        },
        {
            "flag": "-l",
            "long": null,
            "arg": null,
            "description": "Specifies the last page to convert."
        },
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "Specifies the resolution, in DPI. The default is 72 DPI."
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": "Specifies the x-coordinate of the crop area top left corner"
        },
        {
            "flag": "-y",
            "long": null,
            "arg": null,
            "description": "Specifies the y-coordinate of the crop area top left corner"
        },
        {
            "flag": "-W",
            "long": null,
            "arg": null,
            "description": "Specifies the width of crop area in pixels (default is 0)"
        },
        {
            "flag": "-H",
            "long": null,
            "arg": null,
            "description": "Specifies the height of crop area in pixels (default is 0)"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Maintain (as best as possible) the original physical layout of the text. The default is to ´undo' physical layout (columns, hyphenation, etc.) and output the text in read‐ ing order."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Assume fixed-pitch (or tabular) text, with the specified character width (in points). This forces physical layout mode."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "formatting, etc. Use of raw mode is no longer recommended."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Generate a simple HTML file, including the meta information. This simply wraps the text in <pre> and </pre> and prepends the meta headers."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Generate an XHTML file containing bounding box information for each block, line, and word in the file."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use the crop box rather than the media box with -bbox and -bbox-layout."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Sets the encoding to use for text output. This defaults to \"UTF-8\"."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Lists the available encodings"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Sets the end-of-line convention to use for text output."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Don't insert page breaks (form feed characters) between pages."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify the owner password for the PDF file. Providing this will bypass all security restrictions."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify the user password for the PDF file."
        },
        {
            "flag": "-q",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": ""
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "pdfdetach",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdfdetach/1/json"
        },
        {
            "name": "pdffonts",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdffonts/1/json"
        },
        {
            "name": "pdfimages",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdfimages/1/json"
        },
        {
            "name": "pdfinfo",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdfinfo/1/json"
        },
        {
            "name": "pdftocairo",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdftocairo/1/json"
        },
        {
            "name": "pdftohtml",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdftohtml/1/json"
        },
        {
            "name": "pdftoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdftoppm/1/json"
        },
        {
            "name": "pdftops",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdftops/1/json"
        },
        {
            "name": "pdfseparate",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdfseparate/1/json"
        },
        {
            "name": "pdfsig",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdfsig/1/json"
        },
        {
            "name": "pdfunite",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pdfunite/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Convert PDF files to plain text format.",
        "examples": [
            {
                "description": "Convert `filename.pdf` to plain text and print it to `stdout`",
                "command": "pdftotext {{filename.pdf}} -"
            },
            {
                "description": "Convert `filename.pdf` to plain text and save it as `filename.txt`",
                "command": "pdftotext {{filename.pdf}}"
            },
            {
                "description": "Convert `filename.pdf` to plain text and preserve the layout",
                "command": "pdftotext -layout {{filename.pdf}}"
            },
            {
                "description": "Convert `input.pdf` to plain text and save it as `output.txt`",
                "command": "pdftotext {{input.pdf}} {{output.txt}}"
            },
            {
                "description": "Convert pages 2, 3, and 4 of `input.pdf` to plain text and save them as `output.txt`",
                "command": "pdftotext -f {{2}} -l {{4}} {{input.pdf}} {{output.txt}}"
            }
        ]
    }
}