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 <url>
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 using this
262 --page-size optionthis can be changed to almost anything else, such as:
263 A3, Letter and Legal. For a full list of supported pages sizes please
264 see <http://qt-project.org/doc/qt-4.8/qprinter.html#PaperSize-enum>.
265
266 For a more fine grained control over the page size the --page-height
267 and --page-width options may be used
268
269
270
272 If you need to convert a lot of pages in a batch, and you feel that
273 wkhtmltopdf is a bit too slow to start up, then you should try
274 --read-args-from-stdin,
275
276 When --read-args-from-stdin each line of input sent to wkhtmltopdf on
277 stdin will act as a separate invocation of wkhtmltopdf, with the argu‐
278 ments specified on the given line combined with the arguments given to
279 wkhtmltopdf
280
281 For example one could do the following:
282
283 echo "http://qt-project.org/doc/qt-4.8/qapplication.html qapplica‐
284 tion.pdf" >> cmds
285 echo "cover google.com http://en.wikipedia.org/wiki/Qt_(software)
286 qt.pdf" >> cmds
287 wkhtmltopdf --read-args-from-stdin --book < cmds
288
289
290
292 The current page breaking algorithm of WebKit leaves much to be
293 desired. Basically WebKit will render everything into one long page,
294 and then cut it up into pages. This means that if you have two columns
295 of text where one is vertically shifted by half a line. Then WebKit
296 will cut a line into to pieces display the top half on one page. And
297 the bottom half on another page. It will also break image in two and so
298 on. If you are using the patched version of QT you can use the CSS
299 page-break-inside property to remedy this somewhat. There is no easy
300 solution to this problem, until this is solved try organizing your HTML
301 documents such that it contains many lines on which pages can be cut
302 cleanly.
303
304
305
307 If you experience bugs or want to request new features please visit
308 <https://github.com/wkhtmltopdf/wkhtmltopdf/issues>
309
310
311
313 Jakob Truelsen <antialize@gmail.com>
314 Ashish Kulkarni <kulkarni.ashish@gmail.com>
315 Jan Habermann <jan@habermann24.com>
316 Pablo Ruiz García <pablo.ruiz@gmail.com>
317 Trevor North <trevor@blubolt.com>
318 Nate Pinchot <nate.pinchot@gmail.com>
319 pussbb <pussbb@gmail.com>
320 Aaron Stone <aaron@serendipity.cx>
321 Patrick Widauer @a-ctor
322 Peter van der Tak <pta@ibuildgreen.eu>
323 Benjamin Sinkula <bsinky@gmail.com>
324 Kasper F. Brandt <poizan@poizan.dk>
325 Michael Nitze <michael.nitze@online.de>
326 Rok Dvojmoc <rok.dvojmoc@gmail.com>
327 theirix <theirix@gmail.com>
328 Artem Butusov <art.sormy@gmail.com>
329 Christian Sciberras <uuf6429@gmail.com>
330 Daniel M. Lambea <dmlambea@gmail.com>
331 Douglas Bagnall <douglas@paradise.net.nz>
332 peterrehm <peter.rehm@renvest.de>
333 Renan Gonçalves <renan.saddam@gmail.com>
334 Ruslan Grabovoy <kudgo.test@gmail.com>
335 Sander Kleykens <sander.kleykens@avnu.be>
336 Adam Thorsen <adam.thorsen@gmail.com>
337 Albin Kerouanton <albin.kerouanton@knplabs.com>
338 Alejandro Dubrovsky <alito@organicrobot.com>
339 Arthur Cinader @acinader
340 Benoit Garret <benoit.garret@gmail.com>
341 Bill Kuker <bkuker@billkuker.com>
342 cptjazz <alexander@jesner.eu>
343 daigot <daigot@rayze.com>
344 Destan Sarpkaya @destan
345 Duncan Smart <duncan.smart@gmail.com>
346 Emil Lerch <emil@lerch.org>
347 Erik Hyrkas <erik.hyrkas@thomsonreuters.com>
348 Erling Linde <erlingwl@gmail.com>
349 Fábio C. Barrionuevo da Luz <bnafta@gmail.com>
350 Fr33m1nd <lukion@gmx.de>
351 Frank Groeneveld <frank@frankgroeneveld.nl>
352 Immanuel Häussermann <haeussermann@gmail.com>
353 Jake Petroules <jake.petroules@petroules.com>
354 James Macdonald <james@kingfisher-systems.co.uk>
355 Jason Smith <JasonParallel@gmail.com>
356 John Muccigrosso @Jmuccigr
357 Julien Le Goff <julego@gmail.com>
358 Kay Lukas <kay.lukas@gmail.com>
359 Kurt Revis <krevis@snoize.com>
360 laura @holamon
361 Marc Laporte <marc@laporte.name>
362 Matthew M. Boedicker <matthewm@boedicker.org>
363 Matthieu Bontemps <matthieu.bontemps@gmail.com>
364 Max Sikstrom <max.sikstrom@op5.com>
365 Nolan Neustaeter <github@noolan.ca>
366 Oleg Kostyuk <cub.uanic@gmail.com>
367 Pankaj Jangid <pankaj.jangid@gmail.com>
368 robinbetts <robinbetts@yahoo.com>
369 Sem <spam@esemi.ru>
370 Stefan Weil <sw@weilnetz.de>
371 Stephen Kennedy <sk4425@gmail.com>
372 Steve Shreeve <steve.shreeve@gmail.com>
373 Sven Nierlein <sven@nierlein.org>
374 Tobin Juday <tobinibot@gmail.com>
375 Todd Fisher <todd.fisher@gmail.com>
376 Костадин Дамянов <maxmight@gmail.com>
377 Emmanuel Bouthenot <kolter@openics.org>
378 rainabba
379 Mehdi Abbad
380 Lyes Amazouz
381 Pascal Bach
382 Mário Silva
383
384
385
386
387
388 2009 February 23 WKHTMLTOPDF(1)