wkhtmltopdf

How to run custom Javascript on Wkhtmltopdf/wkhtmltoimage?

↘锁芯ラ 提交于 2019-12-03 14:15:35
I want to run a javascript on a website, but when I do it, nothing changes, I get the pdf as if I run no result of the javascript on it, this is an example of what I do: xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltoimage --run-script "javascript:(\$(function(){ \$("div").hide() ;}))" google.com google.png I have also scripts without jquery like: xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltopdf --run-script "javascript:(function(){ document.write("AHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"); ;})" google.com p2.pdf But as I said, no effect on the pdf or the png (because I have tried

WKHTMLTOPDF: How to disable header on the first page

老子叫甜甜 提交于 2019-12-03 12:57:46
问题 wkhtml doesn´t repeat table elements "th" on every page like it should. So I thought it could be possible to simply use the --header-html option and add the table headers manually this way. But I don´t want them on the first page, since there are table headers already, plus some other first page stuff... I found some JS solution, but its too much complicated for me, since I know just the very basics of JS... Any ideas? 回答1: Did you try the JS solution? It's actually not that complicated. I

Getting PDF from WickedPDF for attachment via Carrierwave

ⅰ亾dé卋堺 提交于 2019-12-03 10:28:17
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 status. When an invoice goes from "unbilled" to "billed" state, I would like to grab a copy of the invoice PDF and attach it to the invoice model using CarrierWave. I have the three parts working separately: the controller creates a PDF view, the model tracks state and triggers a callback when making the correct transition, and CarrierWave is set up

wkhtmltopdf css sizes in cm/mm

筅森魡賤 提交于 2019-12-03 09:46:31
I use wkhtmltopdf to produce A4 sized PDFs. When I create a <div> tag and set its style to height: 297mm; width: 210mm (which is the defined size of A4), set wkhtmltopdf's margin settings to 0 ( wkhtmltopdf -B 0 -T 0 -L 0 -R 0 ... ) and give the <div> a red background, I can see a thin white line at the bottom of the page, i.e. the <div> is not filling the page completely. This is happening consistently with 0.11.0 rc1 (the latest version) on Debian and with 0.10.0 rc2 on Mac OS X. Has anyone else seen this? Is this a known problem, or is there a workaround? I had a method that worked for me

wkhtmltopdf codeigniter

泄露秘密 提交于 2019-12-03 09:02:47
wkhtmltopdf sounds like an excellent solution...the problem is nothing happens on the exec shell_exec("c:\wkhtmltopdf.exe"," http://www.google.com google.pdf"); Am i doing anything wrong? Can you use the "official" class? http://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp If not, perhaps peeking into how they did things will help you out with your implementation. // Include WKPDF class. require_once('wkhtmltopdf/wkhtmltopdf.php'); // Create PDF object. $pdf = new WKPDF(); // Set PDF's HTML $pdf->set_html('Hello <b>Mars<.b>!'); // Convert HTML to PDF $pdf->render(); // Output PDF. The

Fix wkhtmltopdf headers clipping content?

余生长醉 提交于 2019-12-03 08:46:11
问题 My headers often clip content so that the content below it is not completely visible, it appears as though the page continues underneath the header before the header ends and as a result, not all of the content is shown. Is there a CSS rule I can use for this? Or a cmd argument for wkhtmltopdf? Or any other way? 回答1: I have learned that this is actually a known issue and is unlikely to be changed in a while. The workaround is to use style="margin:0; padding:0;" in the header <body> element.

unable to install wkhtmltopdf with patched qt in ubuntu 16.04

筅森魡賤 提交于 2019-12-03 07:48:54
wkhtmltopdf with patched qt pkg is not available for ubuntu 16.04 .so i am install 14.04 pkg which is install without patched qt but it need it with patched qt. I also tried with static version but it give some compilation error The patched version of wkhtmltopdf is not present in the Ubuntu repository. You can download it from the project website if you want. But they still don't have a .deb file for Xenial Xerus, so you need to download the binary file and install the dependencies ( libxrender1 fontconfig xvfb ) manually. Here is a script that installs the patched version from the project

wkhtmltopdf: Is it possible to merge PDF files?

倖福魔咒の 提交于 2019-12-03 05:59:30
Using this library wkhtmltopdf , is it possible to merge 2 pdf files. I need to generate a report and merge the report with some attached documents. Generation of report is done, converting from HTML to PDF. But I need to merge the resulting PDF with some other PDFs user2339071 wkhtmltopdf doesn't provide support for merging PDF's. You can accomplish this using GhostScript . It's a pretty powerful tool and frequently used by Linux users. You can use the following command: gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf You can try these links for further reading:

WKHTMLTOPDF Installation error on Ubuntu

筅森魡賤 提交于 2019-12-03 05:04:46
问题 We require features like header, footer, table of contents and cover page of pdf, which we want to generate from html/css. We tried WKHTML on windows and it worked like a charm, when moving to our server, we installed WKHTML on our ubuntu server, installation process was successful but it had only limited features, it was able to generate pdf from HTML but all features mentioned (i-e header, footer , table of content and cover page) wasn't working. Following is the error which it was

wkhtmltopdf footer-html encoding utf-8

人盡茶涼 提交于 2019-12-03 04:27:06
wkhtmltopdf --encoding utf-8 is not working for --footer-html. I am using the following command. Both HTML files are also in utf8 format. wkhtmltopdf --dpi 120 -O Portrait --encoding 'utf-8' --footer-html /tmp/testFooter.html /tmp/testMain.html /tmp/testPDF.pdf Both files have french characters. But in pdf footer have bad characters. <html> <head> <title></title> </head> <body> <div style="width:95%;font-size:9pt;font-family:Arial;"> <div style="border-top: 1px solid black;width: 100%;text-align: center;"> test - Guérin 691BANNE - FRANCE - SA au capital 0 Euros -737 729 - Téléphone : 86 03<