Wkhtmltopdf Characters in single line partially cut between pages
I did have this problem with a table: Then I added this to my CSS: table, img, blockquote {page-break-inside: avoid;} This fixed the problem:
I did have this problem with a table: Then I added this to my CSS: table, img, blockquote {page-break-inside: avoid;} This fixed the problem:
Possibly unrelated as your pdf generated ok with an earlier version of wkhtmltopdf. Either way, I had similar issues with page breaks not being applied correctly. My problem was parent elements of the page-breaked element having an overflow other than visible. This fixed my issue: * { overflow: visible !important; } Of course, you can … Read more
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
Update: My answer below, creates the pdf file on the disk. I then streamed that file to the users browser as a download. Consider using something like Hath’s answer below to get wkhtml2pdf to output to a stream instead and then send that directly to the user – that will bypass lots of issues with … Read more
Wkhtmltopdf does support even very complex headers and footers. wkhtmltopdf.exe -T 50mm –header-html www.google.com www.stackoverflow.com test.pdf && test.pdf That command uses the page at www.google.com as a 50mm header for www.stackoverflow.com for every page. Note: If you use a custom page for the header/footer, you need to add <!DOCTYPE HTML> in the beginning of your … Read more
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>
The Unix packages x11-libs/libXext and x11-libs/libXrender are dependencies Gentoo: sudo emerge libXext libXrender PDFkit wiki also explains in more detail how to get wkhtmltopdf working on engine yard. PDFkit wiki Debian or Ubuntu: sudo apt-get install libxrender1
Actually it’s much simpler than with the code snippet. You can add the following argument on the command line: –footer-center [page]/[topage]. Like richard mentioned, further variables are in the Footers and Headers section of the documentation.
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
To convert HTML to PDF by wkhtmltopdf try to avoid woff font face. Use the truetype format of the Google Web Fonts with base64 encode. Recently I tried to use a Google web font from Google Web Fonts. In the browser it shows correctly but it doesn’t show after converting HTML to PDF. After searching … Read more