1WKHTMLTOPDF(1) General Commands Manual WKHTMLTOPDF(1)
2
3
4
6 wkhtmltopdf - html to pdf converter
7
8
9
11 wkhtmltopdf [GLOBAL OPTION]... [OBJECT]... <output file>
12
13
14
16 wkhtmltopdf is able to put several objects into the output file, an
17 object is either a single webpage, a cover webpage or a table of con‐
18 tents. The objects are put into the output document in the order they
19 are specified on the command line, options can be specified on a per
20 object basis or in the global options area. Options from the Global
21 Options section can only be placed in the global options area.
22
23 A page objects puts the content of a single webpage into the output
24 document.
25
26 (page)? <input url/file name> [PAGE OPTION]...
27
28 Options for the page object can be placed in the global options and the
29 page options areas. The applicable options can be found in the Page
30 Options and Headers And Footer Options sections.
31
32 A cover objects puts the content of a single webpage into the output
33 document, the page does not appear in the table of contents, and does
34 not have headers and footers.
35
36 cover <input url/file name> [PAGE OPTION]...
37
38 All options that can be specified for a page object can also be speci‐
39 fied for a cover.
40
41 A table of contents object inserts a table of contents into the output
42 document.
43
44 toc [TOC OPTION]...
45
46 All options that can be specified for a page object can also be speci‐
47 fied for a toc, further more the options from the TOC Options section
48 can also be applied. The table of contents is generated via XSLT which
49 means that it can be styled to look however you want it to look. To get
50 an idea of how to do this you can dump the default xslt document by
51 supplying the --dump-default-toc-xsl, and the outline it works on by
52 supplying --dump-outline, see the Outline Options section.
53
54
55
57 Converts one or more HTML pages into a PDF document, not using wkhtml‐
58 topdf patched qt.
59
60
61
63 --collate
64 Collate when printing multiple copies
65 --no-collate
66 Do not collate when printing multiple copies
67 --cookie-jar <path>
68 Read and write cookies from and to the supplied cookie jar file
69 --copies <number>
70 Number of copies to print into the pdf file
71 -d, --dpi <dpi>
72 Change the dpi explicitly (this has no effect on X11 based sys‐
73 tems)
74 -H, --extended-help
75 Display more extensive help, detailing less common command
76 switches
77 -g, --grayscale
78 PDF will be generated in grayscale
79 -h, --help
80 Display help
81 --htmldoc
82 Output program html help
83 --license
84 Output license information and exit
85 --log-level <level>
86 Set log level to: none, error, warn or info
87 -l, --lowquality
88 Generates lower quality pdf/ps. Useful to shrink the result doc‐
89 ument space
90 --manpage
91 Output program man page
92 -B, --margin-bottom <unitreal>
93 Set the page bottom margin
94 -L, --margin-left <unitreal>
95 Set the page left margin
96 -R, --margin-right <unitreal>
97 Set the page right margin
98 -T, --margin-top <unitreal>
99 Set the page top margin
100 -O, --orientation <orientation>
101 Set orientation to Landscape or Portrait
102 --page-height <unitreal>
103 Page height
104 -s, --page-size <Size>
105 Set paper size to: A4, Letter, etc.
106 --page-width <unitreal>
107 Page width
108 -q, --quiet
109 Be less verbose, maintained for backwards compatibility; Same as
110 using --log-level none
111 --read-args-from-stdin
112 Read command line arguments from stdin
113 --readme
114 Output program readme
115 --title <text>
116 The title of the generated pdf file (The title of the first doc‐
117 ument is used if not specified)
118 -V, --version
119 Output version information and exit
120
121
122
124 --allow <path>
125 Allow the file or files from the specified folder to be loaded
126 (repeatable)
127 --background
128 Do print background
129 --no-background
130 Do not print background
131 --bypass-proxy-for <value>
132 Bypass proxy for host (repeatable)
133 --cache-dir <path>
134 Web cache directory
135 --checkbox-checked-svg <path>
136 Use this SVG file when rendering checked checkboxes
137 --checkbox-svg <path>
138 Use this SVG file when rendering unchecked checkboxes
139 --cookie <name> <value>
140 Set an additional cookie (repeatable), value should be url
141 encoded.
142 --custom-header <name> <value>
143 Set an additional HTTP header (repeatable)
144 --custom-header-propagation
145 Add HTTP headers specified by --custom-header for each resource
146 request.
147 --no-custom-header-propagation
148 Do not add HTTP headers specified by --custom-header for each
149 resource request.
150 --debug-javascript
151 Show javascript debugging output
152 --no-debug-javascript
153 Do not show javascript debugging output
154 --encoding <encoding>
155 Set the default text encoding, for input
156 --images
157 Do load or print images
158 --no-images
159 Do not load or print images
160 -n, --disable-javascript
161 Do not allow web pages to run javascript
162 --enable-javascript
163 Do allow web pages to run javascript
164 --javascript-delay <msec>
165 Wait some milliseconds for javascript finish
166 --load-error-handling <handler>
167 Specify how to handle pages that fail to load: abort, ignore or
168 skip
169 --load-media-error-handling <handler>
170 Specify how to handle media files that fail to load: abort,
171 ignore or skip
172 --disable-local-file-access
173 Do not allowed conversion of a local file to read in other local
174 files, unless explicitly allowed with --allow
175 --enable-local-file-access
176 Allowed conversion of a local file to read in other local files.
177 --minimum-font-size <int>
178 Minimum font size
179 --page-offset <offset>
180 Set the starting page number
181 --password <password>
182 HTTP Authentication password
183 --disable-plugins
184 Disable installed plugins
185 --enable-plugins
186 Enable installed plugins (plugins will likely not work)
187 --post <name> <value>
188 Add an additional post field (repeatable)
189 --post-file <name> <path>
190 Post an additional file (repeatable)
191 -p, --proxy <proxy>
192 Use a proxy
193 --proxy-hostname-lookup
194 Use the proxy for resolving hostnames
195 --radiobutton-checked-svg <path>
196 Use this SVG file when rendering checked radiobuttons
197 --radiobutton-svg <path>
198 Use this SVG file when rendering unchecked radiobuttons
199 --run-script <js>
200 Run this additional javascript after the page is done loading
201 (repeatable)
202 --ssl-crt-path <path>
203 Path to the ssl client cert public key in OpenSSL PEM format,
204 optionally followed by intermediate ca and trusted certs
205 --ssl-key-password <password>
206 Password to ssl client cert private key
207 --ssl-key-path <path>
208 Path to ssl client cert private key in OpenSSL PEM format
209 --stop-slow-scripts
210 Stop slow running javascripts
211 --no-stop-slow-scripts
212 Do not Stop slow running javascripts
213 --user-style-sheet <path>
214 Specify a user style sheet, to load with every page
215 --username <username>
216 HTTP Authentication username
217 --window-status <windowStatus>
218 Wait until window.status is equal to this string before render‐
219 ing page
220 --zoom <float>
221 Use this zoom factor
222
223
224
226 By default proxy information will be read from the environment vari‐
227 ables: proxy, all_proxy and http_proxy, proxy options can also by spec‐
228 ified with the -p switch
229
230 <type> := "http://" | "socks5://"
231 <serif> := <username> (":" <password>)? "@"
232 <proxy> := "None" | <type>? <string>? <host> (":" <port>)?
233
234 Here are some examples (In case you are unfamiliar with the BNF):
235
236 http://user:password@myproxyserver:8080
237 socks5://myproxyserver
238 None
239
240
241
243 This version of wkhtmltopdf has been compiled against a version of QT
244 without the wkhtmltopdf patches. Therefore some features are missing,
245 if you need these features please use the static version.
246
247 Currently the list of features only supported with patch QT includes:
248
249 * Printing more than one HTML document into a PDF file.
250 * Running without an X11 server.
251 * Adding a document outline to the PDF file.
252 * Adding headers and footers to the PDF file.
253 * Generating a table of contents.
254 * Adding links in the generated PDF file.
255 * Printing using the screen media-type.
256 * Disabling the smart shrink feature of WebKit.
257
258
259
261 The default page size of the rendered document is A4, but by using the
262 --page-size option this can be changed to almost anything else, such
263 as: A3, Letter and Legal. For a full list of supported pages sizes
264 please see <https://qt-project.org/doc/qt-4.8/qprinter.html#PaperSize-
265 enum>.
266
267 For a more fine grained control over the page size the --page-height
268 and --page-width options may be used
269
270
271
273 If you need to convert a lot of pages in a batch, and you feel that
274 wkhtmltopdf is a bit too slow to start up, then you should try
275 --read-args-from-stdin,
276
277 When --read-args-from-stdin each line of input sent to wkhtmltopdf on
278 stdin will act as a separate invocation of wkhtmltopdf, with the argu‐
279 ments specified on the given line combined with the arguments given to
280 wkhtmltopdf
281
282 For example one could do the following:
283
284 echo "https://qt-project.org/doc/qt-4.8/qapplication.html qapplica‐
285 tion.pdf" >> cmds
286 echo "cover google.com https://en.wikipedia.org/wiki/Qt_(software)
287 qt.pdf" >> cmds
288 wkhtmltopdf --read-args-from-stdin --book < cmds
289
290
291
293 The current page breaking algorithm of WebKit leaves much to be
294 desired. Basically WebKit will render everything into one long page,
295 and then cut it up into pages. This means that if you have two columns
296 of text where one is vertically shifted by half a line. Then WebKit
297 will cut a line into to pieces display the top half on one page. And
298 the bottom half on another page. It will also break image in two and so
299 on. If you are using the patched version of QT you can use the CSS
300 page-break-inside property to remedy this somewhat. There is no easy
301 solution to this problem, until this is solved try organizing your HTML
302 documents such that it contains many lines on which pages can be cut
303 cleanly.
304
305
306
308 If you experience bugs or want to request new features please visit
309 <https://wkhtmltopdf.org/support.html>
310
311
312
314 Jakob Truelsen <antialize@gmail.com>
315 Ashish Kulkarni <ashish@kulkarni.dev>
316 Jan Habermann <jan@habermann24.com>
317 Pablo Ruiz García <pablo.ruiz@gmail.com>
318 Trevor North <trevor@blubolt.com>
319 Nate Pinchot <nate.pinchot@gmail.com>
320 pussbb <pussbb@gmail.com>
321 Aaron Stone <aaron@serendipity.cx>
322 Patrick Widauer @a-ctor
323 Peter van der Tak <pta@ibuildgreen.eu>
324 Benjamin Sinkula <bsinky@gmail.com>
325 Kasper F. Brandt <poizan@poizan.dk>
326 Michael Nitze <michael.nitze@online.de>
327 Rok Dvojmoc <rok.dvojmoc@gmail.com>
328 theirix <theirix@gmail.com>
329 Tomsgu <tomasjakll@gmail.com>
330 Artem Butusov <art.sormy@gmail.com>
331 Christian Sciberras <uuf6429@gmail.com>
332 Daniel M. Lambea <dmlambea@gmail.com>
333 Douglas Bagnall <douglas@paradise.net.nz>
334 peterrehm <peter.rehm@renvest.de>
335 Renan Gonçalves <renan.saddam@gmail.com>
336 Ruslan Grabovoy <kudgo.test@gmail.com>
337 Sander Kleykens <sander.kleykens@avnu.be>
338 Adam Thorsen <adam.thorsen@gmail.com>
339 Albin Kerouanton <albin.kerouanton@knplabs.com>
340 Alejandro Dubrovsky <alito@organicrobot.com>
341 Arthur Cinader @acinader
342 Benoit Garret <benoit.garret@gmail.com>
343 Bill Kuker <bkuker@billkuker.com>
344 cptjazz <alexander@jesner.eu>
345 daigot <daigot@rayze.com>
346 Destan Sarpkaya @destan
347 Duncan Smart <duncan.smart@gmail.com>
348 Emil Lerch <emil@lerch.org>
349 Erik Hyrkas <erik.hyrkas@thomsonreuters.com>
350 Erling Linde <erlingwl@gmail.com>
351 Fábio C. Barrionuevo da Luz <bnafta@gmail.com>
352 Fr33m1nd <lukion@gmx.de>
353 Frank Groeneveld <frank@frankgroeneveld.nl>
354 Immanuel Häussermann <haeussermann@gmail.com>
355 Jake Petroules <jake.petroules@petroules.com>
356 James Macdonald <james@kingfisher-systems.co.uk>
357 Jason Smith <JasonParallel@gmail.com>
358 John Muccigrosso @Jmuccigr
359 Julien Le Goff <julego@gmail.com>
360 Kay Lukas <kay.lukas@gmail.com>
361 Kurt Revis <krevis@snoize.com>
362 laura @holamon
363 Marc Laporte <marc@laporte.name>
364 Matthew M. Boedicker <matthewm@boedicker.org>
365 Matthieu Bontemps <matthieu.bontemps@gmail.com>
366 Max Sikstrom <max.sikstrom@op5.com>
367 Nolan Neustaeter <github@noolan.ca>
368 Oleg Kostyuk <cub.uanic@gmail.com>
369 Pankaj Jangid <pankaj.jangid@gmail.com>
370 robinbetts <robinbetts@yahoo.com>
371 Sem <spam@esemi.ru>
372 Stefan Weil <sw@weilnetz.de>
373 Stephen Kennedy <sk4425@gmail.com>
374 Steve Shreeve <steve.shreeve@gmail.com>
375 Sven Nierlein <sven@nierlein.org>
376 Tobin Juday <tobinibot@gmail.com>
377 Todd Fisher <todd.fisher@gmail.com>
378 Костадин Дамянов <maxmight@gmail.com>
379 Emmanuel Bouthenot <kolter@openics.org>
380 Rami @icnocop
381 Khodeir-hubdoc @Khodeir-hubdoc
382 Jonathan Jefferies @jjok
383 Joe Ayers <joseph.ayers@crunchydata.com>
384 Jeffrey Cafferata <jeffrey@jcid.nl>
385 rainabba
386 Mehdi Abbad
387 Lyes Amazouz
388 Pascal Bach
389 Mário Silva
390
391
392
393
394
395 2009 February 23 WKHTMLTOPDF(1)