wkhtmltopdf generates tiny output on Mac
Asked Answered
G

5

2

I'm running wkhtmltopdf 0.12.4 on Mac OS 10.11.6. When I try to run the basic example "wkhtmltopdf http://google.com google.pdf", though, I'm getting an unusual output. Where I'm expecting something like this:

Expected

(PDF generated directly from Chrome), I'm instead getting this:

enter image description here

It seems odd to me that the default output should be so far off, but I've tried some options as well (including --disable-smart-shrinking) with no luck. Would appreciate any direction you can offer!

Georas answered 26/11, 2016 at 3:40 Comment(1)
I get the same issue. I didn't find solution yetCoupling
S
4

I had the same problem, using wkhtmltopdf version 0.12.4 on a Mac installed via homebrew. I uninstalled that and tried version 0.12.3, downloaded from http://wkhtmltopdf.org/, and now I have normal size output.

Souse answered 3/1, 2017 at 15:13 Comment(0)
W
6

Same here with Mac OS 10.11.6 WKHTMLTOPDF v 0.12.4.

Using --lowquality is the only thing that seems to resolve the "tiny output" issue.

Default wkhtmltopdf output without --lowquality: screenshot

With --lowquality, "tiny output" issue is fixed (and works with additional options like increasing resolution via --viewport-size): --lowquality screenshot

Williwaw answered 12/3, 2017 at 20:45 Comment(1)
This helped me too! Thanks! Never would have guessed that one.Pseudohemophilia
S
4

I had the same problem, using wkhtmltopdf version 0.12.4 on a Mac installed via homebrew. I uninstalled that and tried version 0.12.3, downloaded from http://wkhtmltopdf.org/, and now I have normal size output.

Souse answered 3/1, 2017 at 15:13 Comment(0)
S
1

I have been trying to use the 0.12.4 version on Mac OS 10.13.3. Adding some information about this issue.

  1. This is a known issue in 0.12.4 version. https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3241
  2. It has been fixed in a commit but not yet released as part of 0.12.4 https://github.com/wkhtmltopdf/wkhtmltopdf/commit/1c0e72d2faa6da026edc139fac97fcda43535fd3
  3. the 'lowquality' flag fix discussed above is the fastest way to resolve this OR you can install the 0.12.5 version if you are an advanced user. https://github.com/wkhtmltopdf/wkhtmltopdf/blob/master/CHANGELOG.md
Sarmatia answered 25/2, 2018 at 12:47 Comment(0)
C
0

To solve problem install wkpdftohtml via

brew install Caskroom/cask/wkhtmltopdf
Coupling answered 3/12, 2016 at 14:39 Comment(2)
No difference with this, even explicitly running /usr/local/bin/wkhtmltopdf.Georas
I have the same problem like you describe, and installing via bomebrew help me. I thought that it also help you. I think you should try to install older version.Coupling
A
0

I encountered this issue when running wkhtmltopdf on very large screens, and found that specifying print media-type instead of screen media-type, i.e. via --print-media-type, resolved the issue.

For example:

wkhtmltopdf --print-media-type http://google.com google.pdf
Avril answered 22/12, 2016 at 22:28 Comment(5)
No luck with that here -- running the command as you give it generates the same output as above. It's working well on the Amazon EC2 instance where I need it to work, but still rendering tiny locally.Georas
Have you tried combining --print-media-type with e.g. --page-size letter, specifying the page size?Avril
I have -- still no luck, even with a fresh brew install.Georas
Hmmm, that's strange. Perhaps open an issue in the wkhtmltopdf repo?Avril
Just noticed this issue: github.com/wkhtmltopdf/wkhtmltopdf/issues/3241 (Huge Font Size Difference Between 0.12.3 and 0.12.4) reported in wkhtmltopdf version 0.12.4, could that be the cause here?Avril

© 2022 - 2024 — McMap. All rights reserved.