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:

2263 questions
113
votes
21 answers

wkhtmltopdf: cannot connect to X server

I have been using wkthmltopdf to convert html to pdf documents on-the-fly on my linux web server. The program originally needed X11 or similar X server to run correctly, but through many requests by developers to have this run on servers without…
jeffery_the_wind
  • 13,565
  • 31
  • 87
  • 146
101
votes
11 answers

avoid page break inside row of table

I want to avoid page break inside row of table in html, when I convert html to PDF by wkhtmltopdf. I use page-break-inside:avoid with table- its works, but I have so many rows, then not work. If set display of tr as block or some thing else then it…
Ankit Mittal
  • 1,100
  • 2
  • 7
  • 11
84
votes
19 answers

How to avoid page break inside table row for wkhtmltopdf

I am generating pdf report from html page with one table. I am using wkhtmltopdf for the purpose. when pdf is generated it breaks anywhere in tr tag. I want to avoid it .
Mohammad Sadiq Shaikh
  • 2,886
  • 8
  • 32
  • 53
67
votes
4 answers

How to insert a page break in HTML so wkhtmltopdf parses it?

So basically I'm using wkhtmltopdf to convert a dynamic HTML report to PDF. The report has a particular format and I've been asked to clone that format with HTML. The problem I'm facing is that I can't simulate a 100% functional page break in html…
lenord
  • 861
  • 1
  • 8
  • 16
65
votes
9 answers

Google Web Fonts and PDF generation from HTML with wkhtmltopdf

I am using wkhtmltopdf to convert HTML files in PDF format; it gives surprisingly good results, rendering the PDF exactly as WebKit would do. I am using Google Web Fonts to give users the possibility to customize the appearence of the document they…
Mathieu Rodic
  • 6,120
  • 2
  • 38
  • 47
62
votes
11 answers

How to install wkhtmltopdf on a linux based (shared hosting) web server

I have tried in all ways to get wkhtmltopdf installed on our web server but unfortunately it is not getting installed. I cannot access user/bin folder as stated in a tutorial on installation. On the server in public_html folder there is a sub folder…
Yogi Yang 007
  • 4,668
  • 10
  • 50
  • 71
59
votes
11 answers

Rails: Error running wkhtmltopdf -- (error while loading shared libraries)

When my app runs (or when I run from commandline) the wkhtmltopdf command I get the following error: (showing it from command line) #> wkhtmltopdf wkhtmltopdf: error while loading shared libraries: libXrender.so.1: cannot open shared object file:…
Ben
  • 8,657
  • 6
  • 21
  • 27
58
votes
8 answers

How to do page numbering in header/footer htmls with wkhtmltopdf?

I'm developing an electronic invoicing system, and one of our features is generating PDFs of the invoices, and mailing them. We have multiple templates for invoices, and will create more later, so we decided to use HTML templates, generate HTML…
Tamás Barta
  • 1,472
  • 1
  • 17
  • 23
55
votes
1 answer

How can I use footers and headers with wkhtmltopdf?

I encountered a situation where I had to use footers and headers in my generated PDF printounts. CSS solution works for the first page only. And the only information I found is that it is not supported in WKPDF at all, but this dates back to 2009,…
Vladimir Hraban
  • 3,123
  • 3
  • 21
  • 41
54
votes
11 answers

Calling wkhtmltopdf to generate PDF from HTML

I'm attempting to create a PDF file from an HTML file. After looking around a little I've found: wkhtmltopdf to be perfect. I need to call this .exe from the ASP.NET server. I've attempted: Process p = new Process(); …
Sean
  • 2,443
  • 6
  • 41
  • 53
49
votes
7 answers

How do I get WKHTMLTOPDF to execute via PHP?

This has been asked to some degree before but there are no solutions or accepted answers and I'd like to try and be more comprehensive in my question so: I'm trying to WKHTMLTOPDF up and running via PHP on a shared server (in this case it's…
Jamie
  • 736
  • 1
  • 7
  • 12
47
votes
15 answers

WkHTMLtoPDF not loading local CSS and images

I've seen multiple questions that are very similar to this one, so I was hesitant at first to post it. But nothing suggested resolved my issue and I can't seem to figure out what's wrong myself. For a project I made for one client they wanted to…
stevendesu
  • 13,153
  • 13
  • 76
  • 146
44
votes
6 answers

Why doesn't wkhtmltopdf page-break-after have any effect?

I'm using wkhtmltopdf 0.10.0 rc2 for Mac I have an html like this one :