You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, PDFKit will show all ``wkhtmltopdf`` output. If you don't want it, you need to pass ``quiet`` option:
100
+
By default, PDFKit will run ``wkhtmltopdf`` with ``quiet`` option turned on, since in most cases output is not needed and can cause excessive memory usage and corrupted results. If need to get ``wkhtmltopdf`` output you should pass ``verbose=True`` to API calls:
Due to wkhtmltopdf command syntax, **TOC** and **Cover** options must be specified separately. If you need cover before TOC, use ``cover_first`` option:
110
107
@@ -178,6 +175,29 @@ Also you can use ``configuration()`` call to check if wkhtmltopdf is present in
178
175
Troubleshooting
179
176
---------------
180
177
178
+
Debugging issues with PDF generation
179
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
180
+
181
+
If you struggling to generate correct PDF firstly you should check ``wkhtmltopdf`` output for some clues, you can get it by passing ``verbose=True`` to API calls:
If you are getting strange results in PDF or some option looks like its ignored you should try to run ``wkhtmltopdf`` directly to see if it produces the same result. You can get CLI command by creating ``pdfkit.PDFKit`` class directly and then calling its ``command()`` method:
188
+
189
+
.. code-block:: python
190
+
191
+
import pdfkit
192
+
193
+
r = pdfkit.PDFKit('html', 'string', verbose=True)
194
+
print(''.join(r.command()))
195
+
# try running wkhtmltopdf to create PDF
196
+
output = r.to_pdf()
197
+
198
+
Common errors:
199
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
200
+
181
201
- ``IOError: 'No wkhtmltopdf executable found'``:
182
202
183
203
Make sure that you have wkhtmltopdf in your `$PATH` or set via custom configuration (see preceding section). *where wkhtmltopdf* in Windows or *which wkhtmltopdf* on Linux should return actual path to binary.
0 commit comments