Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,35 @@ You can also pass any options through meta tags in your HTML:

pdfkit.from_string(body, 'out.pdf') #with --page-size=Legal and --orientation=Landscape

Custom Fonts Not Appearing in PDF
--------------------------------

If custom fonts work in HTML but do not appear in the generated PDF, this is usually
a limitation of wkhtmltopdf rather than python-pdfkit.

Common requirements:

- Use absolute paths for font files (relative paths may not resolve correctly)
- Use supported font formats such as .ttf or .otf
- Enable local file access when generating PDFs

Example CSS::

@font-face {
font-family: MyFont;
src: url("file:///absolute/path/to/MyFont.ttf");
}

Example Python::

options = {
"enable-local-file-access": ""
}

pdfkit.from_file("input.html", "output.pdf", options=options)

It is recommended to use wkhtmltopdf version 0.12.6 with patched Qt for best results.

Configuration
-------------

Expand Down