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

I’ve managed to successfully install wkhtmltopdf-amd64 on my shared hosting account without root access. Here’s what i did: Downloaded the relevant static binary v0.10.0 from here: http://code.google.com/p/wkhtmltopdf/downloads/list EDIT: The above has moved to here via ssh on my shared host typed the following: $ wget {relavant url to binary from link above} $ tar -xvf … Read more

WkHTMLtoPDF not loading local CSS and images

In my case – wkhtmltopdf version 0.12.2.1 (with patched qt) – adding a base tag to the head section with the absolute path made sure images and css did get loaded. <html> <head> … <base href=”http://www.example.com/”> <link href=”http://stackoverflow.com/assets/css/style.css” rel=”stylesheet”> … </head>

How do I get WKHTMLTOPDF to execute via PHP?

You can also try my project here. It provides a clean OO interface to the command line utility: https://github.com/mikehaertl/phpwkhtmltopdf Usage is very simple: <?php use mikehaertl\wkhtmlto\Pdf; $pdf = new Pdf; // Add a HTML file, a HTML string or a page from a URL $pdf->addPage(‘/home/joe/page.html’); $pdf->addPage(‘<html>….</html>’); $pdf->addPage(‘http://google.com’); // Add a cover (same sources as above … Read more

wkhtmltopdf: cannot connect to X server

or try this (from http://drupal.org/node/870058) Download wkhtmltopdf. Or better install it with a package manager: sudo apt-get install wkhtmltopdf Extract it and move it to /usr/local/bin/ Rename it to wkhtmltopdf so that now you have an executable at /usr/local/bin/wkhtmltopdf Set permissions: sudo chmod a+x /usr/local/bin/wkhtmltopdf Install required support packages. sudo apt-get install openssl build-essential xorg … Read more

avoid page break inside row of table

You might try this with CSS: <table class=”print-friendly”> <!– The rest of your table here –> </table> <style> table.print-friendly tr td, table.print-friendly tr th { page-break-inside: avoid; } </style> Most CSS rules don’t apply to <tr> tags directly, because of exactly what you pointed out above – they have a unique display style, which doesn’t … Read more