My favorites | Sign in
Project Home Downloads Wiki Issues
Search
for
Usage  
Updated Jul 20, 2011 by antial...@gmail.com

The following lists some usages for wkhtmltopdf, please post more examples in the comments

To convert a remote HTML file to PDF:

wkhtmltopdf http://www.google.com google.pdf

To convert a local HTML file to PDF:

wkhtmltopdf my.html my.pdf

You can also convert to PS files if you like:

wkhtmltopdf my.html my.ps

The eler2.pdf sample file

wkhtmltopdf http://geekz.co.uk/lovesraymond/archive/eler-highlights-2008 eler2.pdf -H --outline

Comment by dav...@sjsoft.com, Aug 17, 2009

Note that on Windows, you can't use absolute path names with drives for HTML files at the moment:

wkhtmltopdf d:\temp\x.html x.pdf

will fail. You need to rather use file:/// URLs:

wkhtmltopdf file:///d:/tmp/x.html x.pdf
Comment by genet...@gmail.com, Sep 3, 2009

I got this to work under Windows perfectly, however, I'm unsure of what to do in OS X -- I downloaded the file and tried running it in a terminal window (cd to directory, then ./wkhtmltopdf-0.8.3.1.i386) and got a permission denied error; then, when running with sudo, got an error saying 'command not found'. Is the i386 file an archive? Or is it simply an executable binary file? And if so, shouldn't I just be able to run it explicitly from the terminal?

Comment by fabianfi...@gmail.com, Sep 3, 2009

I use "wkhtmltopdf-0.8.3.1-OS-X.i386" with MacOS X. After I downloaded, I changed the permissions with chmod +x

Comment by kentc...@gmail.com, Nov 19, 2009

any sample coding how to I run this in PHP exec() in Linux enviroment?

Comment by noelb...@gmail.com, Nov 19, 2009

@kentch84, look at the code for this Drupal module:

http://drupal.org/project/print

Comment by dim....@gmail.com, Jan 13, 2010

Did not know this but if reading a local file, it's important, IMPORTANT that it have the .html extension.

This will NOT work

wkhtmltopdf ./fromhtmlpage ./pdffile

This will

wkhtmltopdf ./fromhtmlpage.html ./pdffile
Comment by rosko.iv...@gmail.com, Jan 18, 2010

Hi there,

What if the images need to be taken from a given directory on the filesystem instead of a website? Like, in the html file there's a <img src="/images/someimage.jpeg">, and the "images" directory is somewhere on the filesystem

Comment by cjbrook...@gmail.com, Feb 5, 2010

Rosko Relative images work fine, I have produced a pdf with:

<img src="images/PHONE.JPG"

You need to run wkhtmltopdf in the directory above images.

Comment by cihanozt...@gmail.com, Feb 10, 2010

How do I use php ?

Centos Apache 2.1 Php 5.2

Comment by inn...@gmail.com, Feb 24, 2010

is there any opportunity to generate PDF files from some directory?

Comment by alc...@gmail.com, Feb 24, 2010

@Rosko <img src="file:///var/path/to/file/image.png"> worked for us

Comment by alc...@gmail.com, Feb 24, 2010

@cihanozturk53

For PHP (Apache MAC OS X) we've used this for generating a pdf from a script we normally display:

ob_start();

passthru('/path/wkhtmltopdf http://example.com/pdf/get_html_for_pdf.php' -');

file_put_contents('/path/to/file.pdf', ob_get_clean());

Comment by nsbing...@gmail.com, Mar 18, 2010

I'm attempting to run wkhtmltopdf-0.9.3-OS-X.i368 from the command line in OSX 10.6.2. I keep getting "command not found." I've ran chmod +x to change the permissions. Has anyone ran into this before?

Comment by jorge.mo...@gmail.com, Mar 25, 2010

Hi, everyone.

I'm successfully generating PDF's here, but somehow I can't use copy and paste on the texts in it. Is there any parameter or configuration that I can setup to change that?

Comment by sirma...@gmail.com, Apr 19, 2010

nsbingham, I downloaded wkhtmltopdf-0.9.3-OS-X.i368, copied it to /usr/local/bin, and then ran chmod 777 on it (yes, overkill I know), and it then worked from the command line. I have OSX 1.6.3

Did you copy it to the /usr/local/bin folder?

Comment by ari...@gmail.com, May 6, 2010

Is there a parameter to produce postscript instead of PDF, writing this to stdout?

Comment by mikko.ny...@gmail.com, Jul 1, 2010

If you are having problems with Chinese/Japanese characters not displaying in documents generated using wkhtmltopdf, make sure you have proper fonts installed in your system! Otherwise, the required fonts will not be embedded to the PDFs.

On Debian Lenny the following aptitude line does the magic:

$ sudo aptitude install ttf-arphic-bkai00mp ttf-arphic-bsmi00lp ttf-arphic-gbsn00lp ttf-arphic-gbsn00lp

This seems to work for at least Chinese and Japanese documents.

Comment by markwran...@gmail.com, Jul 7, 2010

OSX. Permission change not enough. Following sirmarkv's note, I did both (a) did chmod +x (b) moved to /usr/var/bin/

It then ran OK from the command line. Hopefully the manual (at http://madalgo.au.dk/~jakobt/wkhtmltopdf-0.9.9-doc.html) could mention this at some point when being updated (or give a more correct OS X installation instruction).

Comment by davideri...@gmail.com, Jul 19, 2010

I had the same issue on OSX as well. Be nice if it was part of MacPorts? so you could just do sudo port install wkhtmltopdf!

Comment by graphicp...@gmail.com, Aug 11, 2010

I have convert html to pdf in windows 7 system But unable to see final file. I type following line in commandline. wkhtmltopdf file:///f:/download/14264-h/14264-h.htm xxy.pdf But I was not found xxy.pdf anywhere. Please help...

Comment by jain.ne...@gmail.com, Aug 13, 2010

Hi ....I am trying to run wkhtmltopdf from my java program.Am currently using wkhtmltox-0.10.0_beta4-installer.exe for Windows.I use the following command to execute the tool:

String command = "wkhtmltopdf "+ sourceFolderPath+fileName + targetFolderPath +pdfFileName;
Runtime rt = Runtime.getRuntime(); System.out.println(command); Process p5 = rt.exec(command);

This works fine and my pdfs are placed in the target path but the images are missing . Images are provided as a relative link SRC="/ebir/images/dnb_print.gif" . The pdf shows empty white boxes in place of the image

This issue occurs only when i call from java program.When i run from cmd prompt the pdf is dispalyed with images. Please let me know how to run from java .

Comment by patricks...@gmail.com, Sep 3, 2010

does anyone have an example usage for passing page? to the supplied header.html? i can't make it work as noted

Comment by tad.j...@gmail.com, Sep 10, 2010

Where are the docs? http://madalgo.au.dk/~jakobt/wkhtmltopdf-0.9.9-doc.html says: Not Found

The requested URL /~jakobt/wkhtmltopdf-0.9.9-doc.html was not found on this server.

Comment by ablopez...@gmail.com, Nov 17, 2010

When running wkhtmltopdf in PHP using exec() on a Mac OSX environment the call silently fails, as I'm getting a shell return code of 5 and an empty output.

Right after installing it worked perfectly for a few minutes, but then this error started. I've upped PHP's memory_limit up to 1024 MB and checked user/file permissions on both the wkhtmltopdf program, the HTML source file, and the destination folder, and everything is in order.

If the exact command that tried to be run in PHP is run directly from the command line, it works just fine.

Any one has any idea what this code mean?

Comment by Ojam...@gmail.com, Nov 22, 2010

hello, i have a question. I need convert html file to pdf with "Table of Contents". What structure should have my file(how should i show that "current title" should be in table of contents )? Does this lib can do this?

Comment by lvresu...@gmail.com, Nov 26, 2010

is there an option for STDOUT?? Thanks

Comment by jwf...@gmail.com, Dec 9, 2010

On my mac I followed the directions to (a) chmod +x (b)copy it to /usr/local/bin but still had trouble.

I figured it out and feel stupid, but I'm posting it to save someone as clueless as I.

I was trying to invoke it using "wkhtmltoimage" but it needed the full download file name of "wkhtmltoimage-0.10.0_beta4-OS-X.i386".

Comment by Michael....@gmail.com, Dec 13, 2010

To get the styling right, we found we needed to remove the BASE tag from our HTML. Then we just copied our styles directory into the directory with wkhtmltopdf, and then the regular style sheet links in the html were picked up automatically and correctly. Our HTML has:

<link rel="stylesheet" href="styles/main.css" type="text/css" />

Comment by russgall...@gmail.com, Dec 14, 2010

@ablopez824: Find a solution? I'm seeing the exact same results after taking the same steps. Executing the same command via bash works fine. Currently production is Windows (which I haven't tried from an exec call yet), but it'd be nice to have it working locally in OSX to flesh out the rest of the feature.

Comment by kidsofna...@gmail.com, Jan 5, 2011

On Mac OS-X 10.6.5 with Drupal 7rc4. I have downloaded wkhtmltoimage-0.10.0_beta4-OS-X.i386, placed it in modules/print/lib, chmod to 755. Drupal does not recognize it as a PHP tool. What is next?

Comment by rahulnva...@gmail.com, Jan 12, 2011

I've found that if you substitute "-" for one of the arguments, it uses stdin/stdout for that argument. So, if you call "wkhtmltopdf - -" it will read in the HTML from stdin and write the pdf to stdout.

Comment by dirkcrem...@gmail.com, Jan 27, 2011

Hi all!

I have a quiet large document to be converted with references between the HTML files, e. g.:

...

<a name="_glg17.16"></a>(17.16)

...

<a href="#_glg17.16">Equation 17.16</a>

...

After converting this into PDF the link in the document is an absolute poniter to the original html-file like this: file:///C:/some_directory/source_file.html#_glg17.16

Is there any possibility to tell wkhtmltopdf that this link points to somewhere in the same PDF document? The same is for links to other HTML-file which are part of the same PDF document.

I used Version 0.9.9

Thanks in advance.

Comment by bronius....@gmail.com, Feb 27, 2011

Quick tip from experience: Was working with wkhtmltopdf just fine locally and on a remote staging, but when I set up a third staging, this time on a fictitious domain with only /etc/hosts definition, my generated PDF was unformatted. Turns out it could not find my attached css or other assets. Adding its false domain to /etc/hosts on that staging server (the one that was running the site and wkhtmltopdf) solved it.

Comment by michael....@gmail.com, Mar 2, 2011

Hi, I need a little help.. I want to convert a simple html file to pdf.

html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>content</title> <style type="text/css" media="screen"> #footer{ margin-top: 68px; margin-left: 60px; font-family:"Helvetica",Times,serif; font-weight: bolder; font-size: 40px; height: 60px; } #infooter{ margin-left: 60px; color: black; margin:0pt auto; } </style> </head> <body>

<img src="file:///C:/html2ps/source/Logo_pos_100_transparent.png" alt="Logo" border="0" width="17%" height="6%" style="position: absolute; top:60px; left:540px;">
<div id="footer"> <div id="infooter">Some Text</div> </div> </body> </html>

but i get only a file with 0KB! i can't open it. wkhtmltopdf give me this output (from cmd): c:\html2pdf>wkhtmltopdf.exe content.html content.pdf Loading pages (1/6) Counting pages (2/6) Resolving Links (4/6) Loading headers and footers (5/6) Printing pages (6/6) [===============================================================] Page 1 of 1 c:\html2pdf>

There is no "done" and i dont know why.

Thank you for helping me...

M.M.

Comment by annesley...@gmail.com, Mar 3, 2011

I know this is ugly. No really.

My website had all absolute links for CSS and images e.g. <img src="/societycard/images/thing.png" />

I mucked about with process working directories for ages and then gave up and did something naughty:

(pwd:/) ln -s /var/www/xsearch/societycard

And hey presto everything worked. Would welcome another solution!

BTW: I am using XSL/XML systems and all includes are absolute to ensure that the transform works on server and client. That is why image links are as well, to follow suit.

Comment by Anastasi...@gmail.com, Mar 11, 2011

Is -toc option removed from 0.10.0 version? It is in the extended help but not in the simple help and of course the program does not recognize it if passed as an argument.

Comment by alex.mor...@gmail.com, Mar 24, 2011

Hi, I try get dimensions of body in html file, this file is composed by div as a header and a table maked whith divs y css (display:table, display:table-row), etc. Well, if I launch a script on document.load event for get height and width dimension (offsetHeight/offsetWidth ) in Firefox

height : 707 width: 1662
Opera
height : 702 width: 1662
Chromium
height: 680 Ancho: 1662

but in wkhtml (0.9.6) I get

height : 10394 width: 0
I don't understand which mean this numbers ?? The PDF cocument have a only one sheet, Letter in landscape mode. Anybody tell me which mean this numbers ? Thanks.

Comment by casey.jo...@gtempaccount.com, Mar 30, 2011

Just wondering, is there a way to have access to the variables like 'title' in the cover page html?

We are doing some dynamic generation of the pdf's and I would like to be able to add a title to the cover page dynamically.

Thanks,

Casey

Comment by mstorer3...@gmail.com, Apr 7, 2011

Feature Request: Page Width & Page Height tweaks

It'd be nice to note in the -H usage that --page-width and --page-height:

  1. on't function unless both are present
  2. re specified in millimeters

And if you wanted to go Really Crazy you could add "point" based variants on --page-width and --page-height since that's how PDF pages are defined. Us PDF-native-speakers would appreciate it. The rest of us silly backwards folks from the states might appreciate being able to specify dimensions in inches while you're at it.

How about accepting some subset of html's unit definition postfix string thingamajiggers. "pt", "mm", "in". Leave "mm" the default for backward compatibility. You /could/ through in some of the others while you're at it, but that's really just gold plating. Points and Inches would actually get used.

And if you want to go gonzo-nutso, you could come up with some way to define individual page sizes rather than a fixed size across all pages. That is of admittedly limited utility, but I should would appreciate it.

Feature Request: custom user agent

Lots of pages out there check for "Safari" or "Chrome" for their webkit-specific layout tweaks, but have never heard of wkhtmltopdf. It'd be nice to trick those pages into using their webkit layout for wkhtmltopdf

In other words: My buttons done shrunk!

None the less: GREAT tool. Love it.

Comment by perdri...@gmail.com, Apr 13, 2011

The usage for wkhtmltoimage (sorry I can't edit the wiki)

Name:

wkhtmltoimage 0.10.0 rc2

Synopsis:

wkhtmltoimage OPTIONS?... <input file> <output file>
Description:
Converts an HTML page into an image,

General Options:

--allow <path> Allow the file or files from the specified
folder to be loaded (repeatable)
--checkbox-checked-svg <path> Use this SVG file when rendering checked
checkboxes
--checkbox-svg <path> Use this SVG file when rendering unchecked
checkboxes
--cookie <name> <value> Set an additional cookie (repeatable) --cookie-jar <path> Read and write cookies from and to the
supplied cookie jar file
--crop-h <int> Set height for croping --crop-w <int> Set width for croping --crop-x <int> Set x coordinate for croping --crop-y <int> Set y coordinate for croping --custom-header <name> <value> Set an additional HTTP header (repeatable) --custom-header-propagation Add HTTP headers specified by
--custom-header for each resource request.
--no-custom-header-propagation Do not add HTTP headers specified by
--custom-header for each resource request.
--debug-javascript Show javascript debugging output --no-debug-javascript Do not show javascript debugging output
(default)
--encoding <encoding> Set the default text encoding, for input
-H, --extended-help Display more extensive help, detailing
less common command switches
-f, --format <format> Output file format (default is jpg)
--height <int> Set screen height (default is calculated
from page content) (default 0)
-h, --help Display help
--htmldoc Output program html help --images Do load or print images (default) --no-images Do not load or print images
-n, --disable-javascript Do not allow web pages to run javascript
--enable-javascript Do allow web pages to run javascript
(default)
--javascript-delay <msec> Wait some milliseconds for javascript
finish (default 200)
--load-error-handling <handler> Specify how to handle pages that fail to
load: abort, ignore or skip (default abort)
--disable-local-file-access Do not allowed conversion of a local file
to read in other local files, unless explecitily allowed with --allow
--enable-local-file-access Allowed conversion of a local file to read
in other local files. (default)
--manpage Output program man page --minimum-font-size <int> Minimum font size --password <password> HTTP Authentication password --disable-plugins Disable installed plugins (default) --enable-plugins Enable installed plugins (plugins will
likely not work)
--post <name> <value> Add an additional post field (repeatable) --post-file <name> <path> Post an additional file (repeatable)
-p, --proxy <proxy> Use a proxy
--quality <int> Output image quality (between 0 and 100)
(default 94)
--radiobutton-checked-svg <path> Use this SVG file when rendering checked
radiobuttons
--radiobutton-svg <path> Use this SVG file when rendering unchecked
radiobuttons
--readme Output program readme --run-script <js> Run this additional javascript after the
page is done loading (repeatable)
-0, --disable-smart-width Use the specified width even if it is not
large enough for the content
--stop-slow-scripts Stop slow running javascripts (default) --no-stop-slow-scripts Do not Stop slow running javascripts
(default)
--transparent Make the background transparent in pngs --user-style-sheet <url> Specify a user style sheet, to load with
every page
--username <username> HTTP Authentication username
-V, --version Output version information an exit
--width <int> Set screen width (default is 1024)
(default 1024)
--window-status <windowStatus> Wait until window.status is equal to this
string before rendering page
--zoom <float> Use this zoom factor (default 1)

Specifying A Proxy:

By default proxy information will be read from the environment variables: proxy, all_proxy and http_proxy, proxy options can also by specified with the -p switch

<type> := "http://" | "socks5://" <serif> := <username> (":" <password>)? "@" <proxy> := "None" | <type>? <sering>? <host> (":" <port>)?

Here are some examples (In case you are unfamiliar with the BNF):

http://user:password@myproxyserver:8080 socks5://myproxyserver None

Contact:

If you experience bugs or want to request new features please visit <http://code.google.com/p/wkhtmltopdf/issues/list>, if you have any problems or comments please feel free to contact me: <uuf6429@gmail.com>

Comment by izayn...@gmail.com, Jul 6, 2011

Hi! I've got problems on windows with asp.net:

p.StartInfo.UseShellExecute = false;
                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.FileName =
                         Server.MapPath("~/bin/wkhtmltopdf.exe");

                p.StartInfo.Arguments = "file:///d:/tmp/test.html file:///d:/tmp/out.pdf";
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardError = true;

                p.Start();
                p.WaitForExit();

I've set full access do d:\tmp for Process start user, but I'm still getting

Loading pages (1/5)
[>                                                           ] 0%
[======>                                                     ] 10%
[==============================>                             ] 50%
[============================================================] 100%
QPainter::begin(): Returned false
Error: Unable to write to destination

Please help me.

Comment by xgho...@gmail.com, Jul 7, 2011

Didn't want this to get lost in the bug's section because I need this resolved ASAP for an automated system I'm working on.

I can't get the images in this HTML report to work: http://beforethecode.net/report.html

It uses a <BASE HREF> tag to locate the images/stylesheets URL (stylesheets are loading fine) but no images show up. Even after removing the <BASE HREF> and hard coding a local path to the IMG tag's they still don't work within this file... help!

Try it yourself: wkhtmltopdf.exe --disable-smart-shrinking --page-size Letter http://beforethecode.net/report.html report.pdf

Comment by frenchsq...@gmail.com, Jul 13, 2011

How do I turn off the bookmarks bar?

Comment by gitaw...@gmail.com, Aug 1, 2011

I have a question, how to generate a pdf via a string (html markup) ?

Comment by khushalp...@xtremeheights.com, Aug 3, 2011

@izayn i am getting the same error and found the problem, please change your path "d:\tmp\test.html d:\tmp\out.pdf"

and try to comment the 'p.WaitForExit?()

Hope it helps

Khushal

Comment by smoz...@gmail.com, Aug 11, 2011

@gitaw: you need to use $pdf->set_html instead $pdf->set_url. It then creates a temporary hmtl file by using the string input you provided in the local file system, then reads it to create the PDF output and deletes the temporary file.

Comment by smoz...@gmail.com, Aug 11, 2011

@xgho: it works perfect for me.

Comment by lme...@gmail.com, Aug 30, 2011

Some more wkhtmltopdf command line examples:

For converting stories or documents to be sent to handheld devices: wkhtmltopdf -O Landscape -B 0 -L 0 -T 0 -R 0 mystory.htm mypdf.pdf Next step would be to convert it with Imagemagick to jpg files and download to any handheld device that can display jpegs (especially if it doesn't have an ebook reader). More details here: http://www.distasis.com/recipes/portp.htm

To convert documents to e-books: wkhtmltopdf -g --disable-smart-shrinking --no-background --header-center title? --header-font-size 24 --footer-center page? mydoc.htm mypdf.pdf The added flags cause the output to be printed in greyscale, disable shrinking of the output, turn off printing of the background (mine's usually set to grey instead of white be default) and add a centered title in 24 point font size to the header and a footer with the current page number centered.

Comment by lme...@gmail.com, Aug 30, 2011

Looks like the brackets aren't showing on my previous comment for converting documents to e-books when specifying title and page information. If you need exact syntax for the options that isn't mangled by the wiki, you can find it here: http://www.distasis.com/cpp/books.htm#run

Comment by anil_1...@yahoo.co.in, Sep 7, 2011

Is there a way to set user password for the generated pdf i.e it must prompt for password whenever user tries to open the document similar to set_option :user_password in htmldoc

Comment by alujans...@gmail.com, Sep 13, 2011

how to convert not oly one page? if i need all pages on site?

Comment by thehellm...@gmail.com, Sep 28, 2011

Hi, I have an html file. The conversion works fine if the images and CSS are on the local file system. But If I delete CSS and images from the local file system and try to run it it doesn't download the images and CSS from the hrefs all by itself.

Help much appreciated.

Thanks

Comment by i...@all-around-shipping.de, Oct 12, 2011

Hi , how can include a footer and/or header with the php class? Regards

Comment by meirwins...@gmail.com, Oct 18, 2011

I used wkhtmltopdf.exe installer on Windows and I am generating PDF files using JAVA Process Object:

Process process = Runtime.getRuntime().exec("C:\\Program Files\\wkhtmltopdf\\wkhtmltopdf --margin-left 0mm --margin-right 0mm --margin-top 0mm --margin-bottom 0mm --page-size Letter --page-width 216mm --page-height 279mm D:\\env\\tmp\\a.html D:\\env\\tmp\\a.pdf");

InputStream is = process.getInputStream();
byte[] byteArray = IOUtils.toByteArray(is);
System.out.println("WKExporter BYTE ARRAY " + byteArray.length); //=> 0

As you can see I get byteArray.length = 0.

Is it possible to redirect the output to the standard output stream of the process rather than writing it on the disk?

Thanks a lot

Comment by vikas1...@gmail.com, Nov 6, 2011

hi, i am using wkhtmltopdf 0.9.9 . Fonts appear to be bolder in the pdf when i am using transparent png images. Is there a fix for this?

Comment by gedu...@gmail.com, Dec 8, 2011

What does error codes 6 and 11 mean?

Comment by valaj...@gmail.com, Dec 19, 2011

Is there any way to increase quality of PDF? I lose coloring and shadows became nasty.

Comment by riyasval...@gmail.com, Jan 16, 2012

For those who are invoking wkhtmltopdf from another program (java Process object, C#, perl etc):

For some odd reason, the output from wkhtmltopdf goes to stderr and NOT stdout.

So, for example in java, you would have to do:

//ProcessBuilder is the recommended way of creating processes since Java 1.5 
//Runtime.getRuntime.exec() is deprecated. Do not use. 
ProcessBuilder pb = new ProcessBuilder("wkhtmltopdf.exe", htmlFilePath, pdfFilePath);
Process process = pb.start();

BufferedReader errStreamReader = new BufferedReader(new InputStreamReader(process.getErrorStream()); 
//not "process.getInputStream()" 
line = reader.readLine(); 
while(line != null) 
{ 
    System.out.println(line); 
    line = reader.readLine(); 
} 

Also, you MUST read from the stream (even if you do nothing with it) because otherwise the stream buffer will fill and the process will hang and never return.

To futureproof your code, just in case the devs of wkhtmltopdf decide to write to stdout, you can redirect stderr of the child process to stdout and read only one stream like this:

ProcessBuilder pb = new ProcessBuilder("wkhtmltopdf.exe", htmlFilePath, pdfFilePath); 
pb.redirectErrorStream(true); 
Process process = pb.start(); 
BufferedReader inStreamReader = new BufferedReader(new InputStreamReader(process.getInputStream()); 

Hope this helps

Comment by riyasval...@gmail.com, Jan 16, 2012

Update on comment above:

I raised this in the issues section and was promptly replied that this was by design:

 Issue 825 : wkhtmltopdf is writing to STDERR instead of STDOUT

Comment 2 by project member antial...@gmail.com, Today (10 hours ago) This is by design, since we support outputting the actual pdf to stdout. E.g. wkhtmltopdf google.com - > abe.pdf

Comment by MightyC...@gmail.com, Mar 30, 2012

To render PDFs containing chinese characters on a CentOS 5.x server, you additionally need to install chinese fonts.

yum install fonts-chinese.noarch

Also the HTML code should contain the content charset definition in the heads meta-tag:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

Comment by drah...@gmail.com, Apr 6, 2012

Hi, thanks for this awesome application. This is usage for Autoplay Media Studio based LUA 5.1:

File.Run(_SourceFolder .. "\\Data\\pdf\\wkhtmltopdf.exe report.html report.pdf", "", _SourceFolder .. "\\Data\\pdf", SW_HIDE, true) -- convert html to pdf
Shell.Execute(_SourceFolder .. "\\Data\\pdf\\rapor.pdf", "open", "", _SourceFolder .. "\\Data\\pdf", SW_MAXIMIZE, false) -- open converted pdf page

Regards, KintaRo?

Comment by dustin.h...@pruvan.com, May 10, 2012

How does smart width in wkhtmltoimage work? it seems like it always defaults to 1024, and will not honor the body width of my page, which can be much slimmer.

Comment by marcus.b...@gmail.com, May 15, 2012

The packaging for Mac OS X is entirely undocumented and as supplied it doesn't work at all. It's wrapped up as an app but not usable as one: double clicking it does nothing except occasionally doing the interminable bounce of death. The critical thing you actually need is lurking inside the bundle in /path/to/wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf. I got it to work by simply using that binary instead of anything to do with the app. I symlinked it in case there was something in the bundle that it needed:

sudo ln -s /Applications/wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf /usr/local/bin

And now it works.

This took me an entire day to find out: it should be the first thing in the docs, since nothing will work without this information. As others have mentioned, it would be much better if this was made available through MacPorts?/Homebrew/Fink, or built using a normal configure/make process.

I decided to have a go at building it myself (so I could have a 64-bit 10.7 build), which worked, and I documented how I did it on my blog.

Comment by alex.p.w...@gmail.com, May 23 (6 days ago)

QPixmap: Cannot create a QPixmap when no GUI is being used Segmentation fault (core dumped)

Got the above when running in command line mode (the site I was pointing at has SVG-rendered charts) - Ubuntu 12.04 desktop

command: wkhtmltopdf http://www.highcharts.com highcharts.pdf

Any ideas?


Sign in to add a comment
Powered by Google Project Hosting