Questions tagged [wkhtmltopdf]

A shell utility to convert HTML to PDF using the Webkit rendering engine and Qt.

Tool for converting web pages to PDF documents using the WebKit engine. These run entirely "headless" and do not require a display or display service.

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

A page objects puts the content of a singe webpage into the output document.

(page)? <input url/file name> [PAGE OPTION]...

Options for the page object can be placed in the global options and the page options areas. The applicable options can be found in the Page Options and Headers And Footer Options sections.

A cover objects puts the content of a singe webpage into the output document, the page does not appear in the table of content, and does not have headers and footers.

cover <input url/file name> [PAGE OPTION]...

All options that can be specified for a page object can also be specified for a cover.

Resources:

2447 questions
18
votes
3 answers

Internal links with wkhtmltopdf?

I have created a PDF from several web pages using wkhtmltopdf. Is there a way to link across pages, for example from page 10 to 15. I tried creating an element with an ID and then an anchor to link to it, but this does not work within the same page…
yas
  • 3,520
  • 4
  • 25
  • 38
18
votes
2 answers

wkhtmltopdf variable DPIs and page sizes in pixels

I am trying to test out a simple page that I wish to use to generate an A4 PDF at 300 DPI. Which I calculated to be 2480px wide and 3507px high; This is the HTML which I expected to create a single page PDF that has a red border around the edges.…
Matt Harvey
  • 181
  • 1
  • 1
  • 3
18
votes
4 answers

wkhtmltopdf failure when embed an SVG

Has anyone in this vast space has ever had the luck to successfully create a PDF with an embedded SVG on an HTML? I've been receiving segmentation fault all the time. Or perhaps is there any other way to embed an SVG into an HTML file and then…
Jeebsion
  • 343
  • 2
  • 3
  • 10
17
votes
2 answers

How get all computed css properties of element and its children in Javascript

I'm trying to set up a service in python using pdfKit to create a pdf file from html files. So basically I will send my element as string and expect the server to return a pdf version of it, but to be an accurate representation I also need to send a…
Mojimi
  • 2,561
  • 9
  • 52
  • 116
17
votes
2 answers

Getting PDF from WickedPDF for attachment via Carrierwave

In Rails3, I am using the WickedPDF gem to render a PDF format of one of my models. This is working fine: /invoices/123 returns HTML, /invoices/123.pdf downloads a PDF. In my Invoice model, I am using the state_machine gem to keep track of Invoice…
lascarides
  • 335
  • 3
  • 9
16
votes
2 answers

wkhtmltopdf missing SVG paths (Rendering)

I'm using a image inside the HMTL code like here below: Test
iury simoes-sousa
  • 1,440
  • 3
  • 20
  • 37
16
votes
4 answers

Convert html to pdf using Python/Flask

I want to generate pdf file from html using Python + Flask. To do this, I use xhtml2pdf. Here is my code: def main(): pdf = StringIO() pdf = create_pdf(render_template('cvTemplate.html', user=user)) pdf_out = pdf.getvalue() response…
Dmitry_Mahrachev
  • 279
  • 1
  • 2
  • 8
16
votes
5 answers

Is there any wkhtmltopdf option to convert html text rather than file?

I recently stumbled on wkhtmltopdf and have found it to be an excellent tool for on-the-fly conversion from html to pdf in the browser. A typical usage (in Windows) would go: wkhtmltopdf.exe --some-option "
Some html formatted text
"…
Ifedi Okonkwo
  • 3,406
  • 4
  • 33
  • 45
16
votes
2 answers

Mixing page orientations in wkhtmltopdf

I'm using wkhtmltopdf to produce a PDF from a single HTML file, formatted into separate pages using page-break-before: always. For example:
Cover Page
Page 1
Page…
sacohe
  • 768
  • 2
  • 5
  • 13
15
votes
1 answer

How to solve "wkhtmltopdf reported an error: Exit with code 1 due to network error: ProtocolUnknownError" in python pdfkit

I'm using Django. This is code is in views.py. def download_as_pdf_view(request, doc_type, pk): import pdfkit file_name = 'invoice.pdf' pdf_path = os.path.join(settings.BASE_DIR, 'static', 'pdf', file_name) template =…
Nori
  • 2,340
  • 1
  • 18
  • 41
15
votes
3 answers

How to install and run wkhtmltopdf Docker image

I want to install and run wkhtmltopdf from Dockerfile of Spring-Boot application when I will build and run the Spring-boot application. I have written the below given scripts in Dockerfile to install wkhtmltopdf. FROM debian:jessie RUN apt-get…
Vdev
  • 319
  • 1
  • 2
  • 11
15
votes
1 answer

Wicked_pdf avoid page-break-inside not working

This is the result when i use Wicked_pdf to convert my html.erb page to pdf. Problem: Seem table 's tr has been splitted into two pages. What i tried without success: Use page-break-inside as described here or here table, tr, td, th, tbody,…
Nhat Dinh
  • 3,378
  • 4
  • 35
  • 51
15
votes
9 answers

TuesPechkin unable to load DLL 'wkhtmltox.dll'

I've been using TuesPechkin for some time now and today I went to update the nuget package to the new version 2.0.0+ and noticed that Factory.Create() no longer resolved, so I went to read on the GitHub the changes made and noticed it now expects…
devfunkd
  • 3,164
  • 12
  • 45
  • 73
15
votes
4 answers

Jekyll documentation to PDF with TOC

I would like to write documentation using Jekyll with HTML and PDF outputs. Html can have a navigation but the PDF should have table of contents. Is there a free and easy way to do that? The HTML part is easy but I would like to use @media print…
Pekka Mattila
  • 614
  • 8
  • 17
15
votes
3 answers

wkhtmltopdf patched qt?

I'm trying to convert multiple URLs to PDF. However, when I compile wkhtmltopdf or run apt-get install wkhtmltopdf and try, it says: Error: This version of wkhtmltopdf is build against an unpatched version of QT, and does not support more then one…
m3rg
  • 688
  • 2
  • 9
  • 25