{
    "mode": "man",
    "parameter": "WKHTMLTOPDF",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/WKHTMLTOPDF/1/json",
    "generated": "2026-11-25T23:32:14Z",
    "sections": {
        "Name": {
            "content": "wkhtmltopdf - html to pdf converter\n\n\n",
            "subsections": []
        },
        "Synopsis": {
            "content": "wkhtmltopdf [GLOBAL OPTION]... [OBJECT]... <output file>\n\n\n",
            "subsections": []
        },
        "Document objects": {
            "content": "wkhtmltopdf is able to put several objects into the output file, an object is either a single\nwebpage,  a  cover webpage or a table of contents.  The objects are put into the output docu‐\nment in the order they are specified on the command line, options can be specified on  a  per\nobject  basis or in the global options area. Options from the Global Options section can only\nbe placed in the global options area.\n\nA page objects puts the content of a single webpage into the output document.\n\n(page)? <input url/file name> [PAGE OPTION]...\n\nOptions for the page object can be placed in the global options and the page  options  areas.\nThe  applicable  options can be found in the Page Options and Headers And Footer Options sec‐\ntions.\n\nA cover objects puts the content of a single webpage into the output document, the page  does\nnot appear in the table of contents, and does not have headers and footers.\n\ncover <input url/file name> [PAGE OPTION]...\n\nAll options that can be specified for a page object can also be specified for a cover.\n\nA table of contents object inserts a table of contents into the output document.\n\ntoc [TOC OPTION]...\n\nAll  options that can be specified for a page object can also be specified for a toc, further\nmore the options from the TOC Options section can also be applied. The table of  contents  is\ngenerated  via XSLT which means that it can be styled to look however you want it to look. To\nget an idea of how to do this you can  dump  the  default  xslt  document  by  supplying  the\n--dump-default-toc-xsl, and the outline it works on by supplying --dump-outline, see the Out‐\nline Options section.\n\n\n",
            "subsections": []
        },
        "Description": {
            "content": "Converts one or more HTML pages into a PDF document, not using wkhtmltopdf patched qt.\n\n\n",
            "subsections": []
        },
        "Global Options": {
            "content": "--collate\nCollate when printing multiple copies\n--no-collate\nDo not collate when printing multiple copies\n--cookie-jar <path>\nRead and write cookies from and to the supplied cookie jar file\n--copies <number>\nNumber of copies to print into the pdf file",
            "subsections": [
                {
                    "name": "-d, --dpi",
                    "content": "Change the dpi explicitly (this has no effect on X11 based systems)",
                    "flag": "-d",
                    "long": "--dpi"
                },
                {
                    "name": "-H, --extended-help",
                    "content": "Display more extensive help, detailing less common command switches",
                    "flag": "-H",
                    "long": "--extended-help"
                },
                {
                    "name": "-g, --grayscale",
                    "content": "PDF will be generated in grayscale",
                    "flag": "-g",
                    "long": "--grayscale"
                },
                {
                    "name": "-h, --help",
                    "content": "Display help\n--htmldoc\nOutput program html help\n--license\nOutput license information and exit\n--log-level <level>\nSet log level to: none, error, warn or info",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-l, --lowquality",
                    "content": "Generates lower quality pdf/ps. Useful to shrink the result document space\n--manpage\nOutput program man page",
                    "flag": "-l",
                    "long": "--lowquality"
                },
                {
                    "name": "-B, --margin-bottom",
                    "content": "Set the page bottom margin",
                    "flag": "-B",
                    "long": "--margin-bottom"
                },
                {
                    "name": "-L, --margin-left",
                    "content": "Set the page left margin",
                    "flag": "-L",
                    "long": "--margin-left"
                },
                {
                    "name": "-R, --margin-right",
                    "content": "Set the page right margin",
                    "flag": "-R",
                    "long": "--margin-right"
                },
                {
                    "name": "-T, --margin-top",
                    "content": "Set the page top margin",
                    "flag": "-T",
                    "long": "--margin-top"
                },
                {
                    "name": "-O, --orientation",
                    "content": "Set orientation to Landscape or Portrait\n--page-height <unitreal>\nPage height",
                    "flag": "-O",
                    "long": "--orientation"
                },
                {
                    "name": "-s, --page-size",
                    "content": "Set paper size to: A4, Letter, etc.\n--page-width <unitreal>\nPage width",
                    "flag": "-s",
                    "long": "--page-size"
                },
                {
                    "name": "-q, --quiet",
                    "content": "Be  less  verbose,  maintained  for backwards compatibility; Same as using --log-level\nnone\n--read-args-from-stdin\nRead command line arguments from stdin\n--readme\nOutput program readme\n--title <text>\nThe title of the generated pdf file (The title of the first document is  used  if  not\nspecified)",
                    "flag": "-q",
                    "long": "--quiet"
                },
                {
                    "name": "-V, --version",
                    "content": "Output version information and exit\n\n\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "Page Options": {
            "content": "--allow <path>\nAllow the file or files from the specified folder to be loaded (repeatable)\n--background\nDo print background\n--no-background\nDo not print background\n--bypass-proxy-for <value>\nBypass proxy for host (repeatable)\n--cache-dir <path>\nWeb cache directory\n--checkbox-checked-svg <path>\nUse this SVG file when rendering checked checkboxes\n--checkbox-svg <path>\nUse this SVG file when rendering unchecked checkboxes\n--cookie <name> <value>\nSet an additional cookie (repeatable), value should be url encoded.\n--custom-header <name> <value>\nSet an additional HTTP header (repeatable)\n--custom-header-propagation\nAdd HTTP headers specified by --custom-header for each resource request.\n--no-custom-header-propagation\nDo not add HTTP headers specified by --custom-header for each resource request.\n--debug-javascript\nShow javascript debugging output\n--no-debug-javascript\nDo not show javascript debugging output\n--encoding <encoding>\nSet the default text encoding, for input\n--images\nDo load or print images\n--no-images\nDo not load or print images",
            "subsections": [
                {
                    "name": "-n, --disable-javascript",
                    "content": "Do not allow web pages to run javascript\n--enable-javascript\nDo allow web pages to run javascript\n--javascript-delay <msec>\nWait some milliseconds for javascript finish\n--load-error-handling <handler>\nSpecify how to handle pages that fail to load: abort, ignore or skip\n--load-media-error-handling <handler>\nSpecify how to handle media files that fail to load: abort, ignore or skip\n--disable-local-file-access\nDo not allowed conversion of a local file to read in other local files, unless explic‐\nitly allowed with --allow\n--enable-local-file-access\nAllowed conversion of a local file to read in other local files.\n--minimum-font-size <int>\nMinimum font size\n--page-offset <offset>\nSet the starting page number\n--password <password>\nHTTP Authentication password\n--disable-plugins\nDisable installed plugins\n--enable-plugins\nEnable installed plugins (plugins will likely not work)\n--post <name> <value>\nAdd an additional post field (repeatable)\n--post-file <name> <path>\nPost an additional file (repeatable)",
                    "flag": "-n",
                    "long": "--disable-javascript"
                },
                {
                    "name": "-p, --proxy",
                    "content": "Use a proxy\n--proxy-hostname-lookup\nUse the proxy for resolving hostnames\n--radiobutton-checked-svg <path>\nUse this SVG file when rendering checked radiobuttons\n--radiobutton-svg <path>\nUse this SVG file when rendering unchecked radiobuttons\n--run-script <js>\nRun this additional javascript after the page is done loading (repeatable)\n--ssl-crt-path <path>\nPath  to  the ssl client cert public key in OpenSSL PEM format, optionally followed by\nintermediate ca and trusted certs\n--ssl-key-password <password>\nPassword to ssl client cert private key\n--ssl-key-path <path>\nPath to ssl client cert private key in OpenSSL PEM format\n--stop-slow-scripts\nStop slow running javascripts\n--no-stop-slow-scripts\nDo not Stop slow running javascripts\n--user-style-sheet <path>\nSpecify a user style sheet, to load with every page\n--username <username>\nHTTP Authentication username\n--window-status <windowStatus>\nWait until window.status is equal to this string before rendering page\n--zoom <float>\nUse this zoom factor\n\n\n",
                    "flag": "-p",
                    "long": "--proxy"
                }
            ]
        },
        "Specifying A Proxy": {
            "content": "By default proxy information will be read from the environment  variables:  proxy,  allproxy\nand httpproxy, proxy options can also by specified with the -p switch\n\n<type> := \"http://\" | \"socks5://\"\n<serif> := <username> (\":\" <password>)? \"@\"\n<proxy> := \"None\" | <type>? <string>? <host> (\":\" <port>)?\n\nHere are some examples (In case you are unfamiliar with the BNF):\n\nhttp://user:password@myproxyserver:8080\nsocks5://myproxyserver\nNone\n\n\n",
            "subsections": []
        },
        "Reduced Functionality": {
            "content": "This version of wkhtmltopdf has been compiled against a version of QT without the wkhtmltopdf\npatches.  Therefore some features are missing, if you need these features please use the sta‐\ntic version.\n\nCurrently the list of features only supported with patch QT includes:\n\n* Printing more than one HTML document into a PDF file.\n* Running without an X11 server.\n* Adding a document outline to the PDF file.\n* Adding headers and footers to the PDF file.\n* Generating a table of contents.\n* Adding links in the generated PDF file.\n* Printing using the screen media-type.\n* Disabling the smart shrink feature of WebKit.\n\n\n",
            "subsections": []
        },
        "Page sizes": {
            "content": "The default page size of the rendered document is A4, but by  using  the  --page-size  option\nthis  can be changed to almost anything else, such as: A3, Letter and Legal.  For a full list\nof supported pages sizes please  see  <https://qt-project.org/doc/qt-4.8/qprinter.html#Paper‐\nSize-enum>.\n\nFor a more fine grained control over the page size the --page-height and --page-width options\nmay be used\n\n\n",
            "subsections": []
        },
        "Reading arguments from stdin": {
            "content": "If  you need to convert a lot of pages in a batch, and you feel that wkhtmltopdf is a bit too\nslow to start up, then you should try --read-args-from-stdin,\n\nWhen --read-args-from-stdin each line of input sent to wkhtmltopdf on stdin  will  act  as  a\nseparate  invocation  of wkhtmltopdf, with the arguments specified on the given line combined\nwith the arguments given to wkhtmltopdf\n\nFor example one could do the following:\n\necho \"https://qt-project.org/doc/qt-4.8/qapplication.html qapplication.pdf\" >> cmds\necho \"cover google.com https://en.wikipedia.org/wiki/Qt(software) qt.pdf\" >> cmds\nwkhtmltopdf --read-args-from-stdin --book < cmds\n\n\n",
            "subsections": []
        },
        "Page Breaking": {
            "content": "The current page breaking algorithm of WebKit leaves much to  be  desired.  Basically  WebKit\nwill  render everything into one long page, and then cut it up into pages. This means that if\nyou have two columns of text where one is vertically shifted by half a line. Then WebKit will\ncut a line into to pieces display the top half on one page. And the bottom  half  on  another\npage.  It will also break image in two and so on.  If you are using the patched version of QT\nyou can use the CSS page-break-inside property to remedy this somewhat. There is no easy  so‐\nlution  to this problem, until this is solved try organizing your HTML documents such that it\ncontains many lines on which pages can be cut cleanly.\n\n\n",
            "subsections": []
        },
        "Contact": {
            "content": "If you experience bugs  or  want  to  request  new  features  please  visit  <https://wkhtml‐\ntopdf.org/support.html>\n\n\n",
            "subsections": []
        },
        "Authors": {
            "content": "Jakob Truelsen              <antialize@gmail.com>\nAshish Kulkarni             <ashish@kulkarni.dev>\nJan Habermann               <jan@habermann24.com>\nPablo Ruiz García           <pablo.ruiz@gmail.com>\nTrevor North                <trevor@blubolt.com>\nNate Pinchot                <nate.pinchot@gmail.com>\npussbb                      <pussbb@gmail.com>\nAaron Stone                 <aaron@serendipity.cx>\nPatrick Widauer             @a-ctor\nPeter van der Tak           <pta@ibuildgreen.eu>\nBenjamin Sinkula            <bsinky@gmail.com>\nKasper F. Brandt            <poizan@poizan.dk>\nMichael Nitze               <michael.nitze@online.de>\nRok Dvojmoc                 <rok.dvojmoc@gmail.com>\ntheirix                     <theirix@gmail.com>\nTomsgu                      <tomasjakll@gmail.com>\nArtem Butusov               <art.sormy@gmail.com>\nChristian Sciberras         <uuf6429@gmail.com>\nDaniel M. Lambea            <dmlambea@gmail.com>\nDouglas Bagnall             <douglas@paradise.net.nz>\npeterrehm                   <peter.rehm@renvest.de>\nRenan Gonçalves             <renan.saddam@gmail.com>\nRuslan Grabovoy             <kudgo.test@gmail.com>\nSander Kleykens             <sander.kleykens@avnu.be>\nAdam Thorsen                <adam.thorsen@gmail.com>\nAlbin Kerouanton            <albin.kerouanton@knplabs.com>\nAlejandro Dubrovsky         <alito@organicrobot.com>\nArthur Cinader              @acinader\nBenoit Garret               <benoit.garret@gmail.com>\nBill Kuker                  <bkuker@billkuker.com>\ncptjazz                     <alexander@jesner.eu>\ndaigot                      <daigot@rayze.com>\nDestan Sarpkaya             @destan\nDuncan Smart                <duncan.smart@gmail.com>\nEmil Lerch                  <emil@lerch.org>\nErik Hyrkas                 <erik.hyrkas@thomsonreuters.com>\nErling Linde                <erlingwl@gmail.com>\nFábio C. Barrionuevo da Luz <bnafta@gmail.com>\nFr33m1nd                    <lukion@gmx.de>\nFrank Groeneveld            <frank@frankgroeneveld.nl>\nImmanuel Häussermann        <haeussermann@gmail.com>\nJake Petroules              <jake.petroules@petroules.com>\nJames Macdonald             <james@kingfisher-systems.co.uk>\nJason Smith                 <JasonParallel@gmail.com>\nJohn Muccigrosso            @Jmuccigr\nJulien Le Goff              <julego@gmail.com>\nKay Lukas                   <kay.lukas@gmail.com>\nKurt Revis                  <krevis@snoize.com>\nlaura                       @holamon\nMarc Laporte                <marc@laporte.name>\nMatthew M. Boedicker        <matthewm@boedicker.org>\nMatthieu Bontemps           <matthieu.bontemps@gmail.com>\nMax Sikstrom                <max.sikstrom@op5.com>\nNolan Neustaeter            <github@noolan.ca>\nOleg Kostyuk                <cub.uanic@gmail.com>\nPankaj Jangid               <pankaj.jangid@gmail.com>\nrobinbetts                  <robinbetts@yahoo.com>\nSem                         <spam@esemi.ru>\nStefan Weil                 <sw@weilnetz.de>\nStephen Kennedy             <sk4425@gmail.com>\nSteve Shreeve               <steve.shreeve@gmail.com>\nSven Nierlein               <sven@nierlein.org>\nTobin Juday                 <tobinibot@gmail.com>\nTodd Fisher                 <todd.fisher@gmail.com>\nКостадин Дамянов            <maxmight@gmail.com>\nEmmanuel Bouthenot          <kolter@openics.org>\nRami                        @icnocop\nKhodeir-hubdoc              @Khodeir-hubdoc\nJonathan Jefferies          @jjok\nJoe Ayers                   <joseph.ayers@crunchydata.com>\nJeffrey Cafferata           <jeffrey@jcid.nl>\nrainabba\nMehdi Abbad\nLyes Amazouz\nPascal Bach\nMário Silva\n\n\n\n2009 February 23                            WKHTMLTOPDF(1)",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Convert HTML documents or web pages into PDF files.",
        "examples": [
            {
                "description": "Convert a HTML document into PDF",
                "command": "wkhtmltopdf {{input.html}} {{output.pdf}}"
            },
            {
                "description": "Specify the PDF page size (please see `PaperSize` of `QPrinter` for supported sizes)",
                "command": "wkhtmltopdf --page-size {{A4}} {{input.html}} {{output.pdf}}"
            },
            {
                "description": "Set the PDF page margins",
                "command": "wkhtmltopdf --margin-{{top|bottom|left|right}} {{10mm}} {{input.html}} {{output.pdf}}"
            },
            {
                "description": "Set the PDF page orientation",
                "command": "wkhtmltopdf --orientation {{Landscape|Portrait}} {{input.html}} {{output.pdf}}"
            },
            {
                "description": "Generate a greyscale version of the PDF document",
                "command": "wkhtmltopdf --grayscale {{input.html}} {{output.pdf}}"
            }
        ]
    }
}