other versions
- wheezy 0.9.9-4
- wheezy-backports 0.12.0-2~bpo70+1
- jessie 0.12.1-2
- testing 0.12.3.2-3
- unstable 0.12.3.2-3
| WKHTMLTOPDF(1) | General Commands Manual | WKHTMLTOPDF(1) |
Name¶
wkhtmltopdf - html to pdf converterSynopsis¶
wkhtmltopdf [GLOBAL OPTION]... [OBJECT]... <output file>
Document objects¶
wkhtmltopdf is able to put several objects into the output file, an object is either a single webpage, a cover webpage or a table of content. The objects are put into the output document in the order they are specified on the command line, options can be specified on a per object basis or in the global options area. Options from the Global Options section can only be placed in the global options area(page)? <input url/file name> [PAGE OPTION]...
cover <input url/file name> [PAGE OPTION]...
toc [TOC OPTION]...
Description¶
Converts one or more HTML pages into a PDF document, not using wkhtmltopdf patched qt.Global Options¶
- --collate
- Collate when printing multiple copies
- --no-collate
- Do not collate when printing multiple copies
- --cookie-jar <path>
- Read and write cookies from and to the supplied cookie jar file
- --copies <number>
- Number of copies to print into the pdf file
- -d, --dpi <dpi>
- Change the dpi explicitly (this has no effect on X11 based systems)
- -H, --extended-help
- Display more extensive help, detailing less common command switches
- -g, --grayscale
- PDF will be generated in grayscale
- -h, --help
- Display help
- --htmldoc
- Output program html help
- -l, --lowquality
- Generates lower quality pdf/ps. Useful to shrink the result document space
- --manpage
- Output program man page
- -B, --margin-bottom <unitreal>
- Set the page bottom margin
- -L, --margin-left <unitreal>
- Set the page left margin
- -R, --margin-right <unitreal>
- Set the page right margin
- -T, --margin-top <unitreal>
- Set the page top margin
- -O, --orientation <orientation>
- Set orientation to Landscape or Portrait
- --output-format <format>
- Specify an output format to use pdf or ps, instead of looking at the extension of the output filename
- --page-height <unitreal>
- Page height
- -s, --page-size <Size>
- Set paper size to: A4, Letter, etc.
- --page-width <unitreal>
- Page width
- -q, --quiet
- Be less verbose
- --read-args-from-stdin
- Read command line arguments from stdin
- --readme
- Output program readme
- --title <text>
- The title of the generated pdf file (The title of the first document is used if not specified)
- -V, --version
- Output version information an exit
Page Options¶
- --allow <path>
- Allow the file or files from the specified folder to be loaded (repeatable)
- --background
- Do print background
- --no-background
- Do not print background
- --cache-dir <path>
- Web cache directory
- --checkbox-checked-svg <path>
- Use this SVG file when rendering checked checkboxes
- --checkbox-svg <path>
- Use this SVG file when rendering unchecked checkboxes
- --cookie <name> <value>
- Set an additional cookie (repeatable)
- --custom-header <name> <value>
- Set an additional HTTP header (repeatable)
- --custom-header-propagation
- Add HTTP headers specified by --custom-header for each resource request.
- --no-custom-header-propagation
- Do not add HTTP headers specified by --custom-header for each resource request.
- --debug-javascript
- Show javascript debugging output
- --no-debug-javascript
- Do not show javascript debugging output
- --encoding <encoding>
- Set the default text encoding, for input
- --images
- Do load or print images
- --no-images
- Do not load or print images
- -n, --disable-javascript
- Do not allow web pages to run javascript
- --enable-javascript
- Do allow web pages to run javascript
- --javascript-delay <msec>
- Wait some milliseconds for javascript finish
- --load-error-handling <handler>
- Specify how to handle pages that fail to load: abort, ignore or skip
- --load-media-error-handling <handler>
- Specify how to handle media files that fail to load: abort, ignore or skip
- --disable-local-file-access
- Do not allowed conversion of a local file to read in other local files, unless explicitly allowed with --allow
- --enable-local-file-access
- Allowed conversion of a local file to read in other local files.
- --minimum-font-size <int>
- Minimum font size
- --page-offset <offset>
- Set the starting page number
- --password <password>
- HTTP Authentication password
- --disable-plugins
- Disable installed plugins
- --enable-plugins
- Enable installed plugins (plugins will likely not work)
- --post <name> <value>
- Add an additional post field (repeatable)
- --post-file <name> <path>
- Post an additional file (repeatable)
- -p, --proxy <proxy>
- Use a proxy
- --radiobutton-checked-svg <path>
- Use this SVG file when rendering checked radiobuttons
- --radiobutton-svg <path>
- Use this SVG file when rendering unchecked radiobuttons
- --run-script <js>
- Run this additional javascript after the page is done loading (repeatable)
- --stop-slow-scripts
- Stop slow running javascripts
- --no-stop-slow-scripts
- Do not Stop slow running javascripts
- --user-style-sheet <url>
- Specify a user style sheet, to load with every page
- --username <username>
- HTTP Authentication username
- --window-status <windowStatus>
- Wait until window.status is equal to this string before rendering page
- --zoom <float>
- Use this zoom factor
Specifying A Proxy¶
By default proxy information will be read from the environment variables: proxy, all_proxy and http_proxy, proxy options can also by specified with the -p switch<type> := "http://" | "socks5://"
<serif> := <username> (":" <password>)? "@"
<proxy> := "None" | <type>? <string>? <host> (":" <port>)?
http://user:password@myproxyserver:8080
socks5://myproxyserver
None
Reduced Functionality¶
This version of wkhtmltopdf has been compiled against a version of QT without the wkhtmltopdf patches. Therefore some features are missing, if you need these features please use the static version.* Printing more then one HTML document into a PDF file.
* Running without an X11 server.
* Adding a document outline to the PDF file.
* Adding headers and footers to the PDF file.
* Generating a table of contents.
* Adding links in the generated PDF file.
* Printing using the screen media-type.
* Disabling the smart shrink feature of webkit.
Page sizes¶
The default page size of the rendered document is A4, but using this --page-size optionthis can be changed to almost anything else, such as: A3, Letter and Legal. For a full list of supported pages sizes please see <http://doc.trolltech.com/4.6/qprinter.html#PageSize-enum>.Reading arguments from stdin¶
If you need to convert a lot of pages in a batch, and you feel that wkhtmltopdf is a bit to slow to start up, then you should try --read-args-from-stdin,echo "http://doc.trolltech.com/4.5/qapplication.html qapplication.pdf" >> cmds
echo "cover google.com http://en.wikipedia.org/wiki/Qt_(toolkit) qt.pdf" >> cmds
wkhtmltopdf --read-args-from-stdin --book < cmds
Page Breaking¶
The current page breaking algorithm of WebKit leaves much to be desired. Basically webkit will render everything into one long page, and then cut it up into pages. This means that if you have two columns of text where one is vertically shifted by half a line. Then webkit will cut a line into to pieces display the top half on one page. And the bottom half on another page. It will also break image in two and so on. If you are using the patched version of QT you can use the CSS page-break-inside property to remedy this somewhat. There is no easy solution to this problem, until this is solved try organizing your HTML documents such that it contains many lines on which pages can be cut cleanly.Contact¶
If you experience bugs or want to request new features please visit <http://code.google.com/p/wkhtmltopdf/issues/list>, if you have any problems or comments please feel free to contact me: see <http://www.madalgo.au.dk/~jakobt/#about>Authors¶
Written by Jan Habermann, Christian Sciberras and Jakob Truelsen. Patches by Mehdi Abbad, Lyes Amazouz, Pascal Bach, Emmanuel Bouthenot, Benoit Garret and Mário Silva.| 2009 February 23 |