zakird / wkhtmltopdf_binary_gem Goto Github PK
View Code? Open in Web Editor NEWRuby gem containing easily installable access to wkhtmltopdf application
Home Page: https://rubygems.org/gems/wkhtmltopdf-binary
License: Apache License 2.0
Ruby gem containing easily installable access to wkhtmltopdf application
Home Page: https://rubygems.org/gems/wkhtmltopdf-binary
License: Apache License 2.0
I just updated my project's Gemfile to pull the latest version of this gem from GitHub. I then bundle install
ed, which installed the binary:
> which wkhtmltopdf
/Users/jacobevelyn/.gem/ruby/2.0.0/bin/wkhtmltopdf
However, when I try to use the binary, I get this:
> wkhtmltopdf --version
/Users/jacobevelyn/.rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'wkhtmltopdf-binary' (>= 0) among 814 total gem(s) (Gem::LoadError)
from /Users/jacobevelyn/.rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:309:in `to_spec'
from /Users/jacobevelyn/.rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/jacobevelyn/.gem/ruby/2.0.0/bin/wkhtmltopdf:22:in `<main>'
Any ideas as to where I might be going wrong?
Using upx on shipped wkhtmltopdf binaries drastically reduces their size. Each of the binaries (linux x86, linux x86_64, darwin x86) reduces to about 15MB. And with modern CPUs the decompression time doesn't matter - but there is less I/O involved.
http://wkhtmltopdf.org/downloads.html has binaries for 0.12.3. Is a fork/pull request in order?
Hi, are you please able to compile binaries also for the lastest wkhtmltopdf 0.12.5 version? Thank you
I'm getting an error that says:
Invalid platform, must be running on Ubuntu 16.04/18.04/20.04 CentOS 6/7/8, Debian 9/10, or intel-based Cocoa macOS (missing binary: /home/johnjin0000/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/wkhtmltopdf-binary-0.12.6/bin/wkhtmltopdf_ubuntu_20.04_amd64)
But I am using an ubuntu 20.04 machine, so it would be nice if a binary for 20.04 can be added
In production server (ubuntu 14.04) getting this error
$ wkhtmltopdf http://www.google.com google.pdf
/usr/local/rvm/gems/ruby-2.5.1/gems/wkhtmltopdf-binary-0.12.4/bin/wkhtmltopdf_linux_x86: 1: /usr/local/rvm/gems/ruby-2.5.1/gems/wkhtmltopdf-binary-0.12.4/bin/wkhtmltopdf_linux_x86: Syntax error: word unexpected (expecting ")")
Any help? @zakird
Invalid platform, must be running on Ubuntu 14.04/16.04/18.04 CentOS 6/7, Debian 8/9, or intel-based macOS (missing binary: /home/deploy/runnersconnect/shared/vendor/bundle/ruby/2.6.0/gems/wkhtmltopdf-binary-0.12.5/bin/wkhtmltopdf_ubuntu_19.04_amd64). (RuntimeError)
Had to uninstall this gem and go for manual solution.
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt -f install
The error in mac-os with ruby 2.0.0:
* wkhtmltopdf_binary_gem Copyright 2013 The University of Iowa
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http:/
bin/wkhtmltopdf:13: unknown regexp option - l
bin/wkhtmltopdf:13: syntax error, unexpected '/', expecting :: or '[' or '.'
bin/wkhtmltopdf:15: syntax error, unexpected keyword_elsif, expecting end-of-input
elsif RbConfig::CONFIG['host_os'] =~ /darwin/
Error is happening when render pdf: "pdf_name"
is called inside the controller.
RuntimeError at /reports/1/print
Bad wkhtmltopdf's path: bundler: command not found: which
Install missing gem executables with `bundle install`
Gems I am using - rails 4.2
, wkhtmltopdf-binary 0.9.9.3
, wicked_pdf 0.11.0
.
I have tried upgrading gem to latest version pointing to Github master branch but that doesn't help.
Hi! You need to update the wkhtmltopdf binary to the latest version!
Error: PDF could not be generated!
Command Error: /var/lib/gems/2.5.0/gems/wkhtmltopdf-binary-0.12.5/bin/wkhtmltopdf:34:in `initialize': Permission denied @ rb_sysopen - /var/lib/gems/2.5.0/gems/wkhtmltopdf-binary-0.12.5/bin/wkhtmltopdf_ubuntu_18.04_amd64 (Errno::EACCES)
A RoR app is using wkhtmltopdf-binary to generate PDFs from a web page. It was "bundle upgrade" upgraded earlier today and I started getting this error. I was able to HACK around the error by extracting the .gz file manually:
cd /var/lib/gems/2.5.0/gems/wkhtmltopdf-binary-0.12.5/bin/
gunzip wkhtmltopdf_ubuntu_18.04_amd64.gz
I'm also going to freeze the Gemfile file for my other servers to 0.12.4.
gem 'wkhtmltopdf-binary', '0.12.4'
Error on Amazon Linux 2.
error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
I resolved like this.
This is current code.
wkhtmltopdf_binary_gem/bin/wkhtmltopdf
# CentOS 6 doesn't have `/etc/os-release`.
if (os.empty? && File.read('/etc/centos-release').start_with?('CentOS release 6')) ||
os.start_with?('amzn_')
os = 'centos_6'
end
I changed the code like this.
if os.start_with?('amzn_2')
os = 'centos_7'
end
# CentOS 6 doesn't have `/etc/os-release`.
if (os.empty? && File.read('/etc/centos-release').start_with?('CentOS release 6')) ||
(os.start_with?('amzn_') && !os.start_with?('amzn_2'))
os = 'centos_6'
end
sudo apt-get install libjpeg62 libfontconfig-dev
sudo apt-get install libjpeg-dev libfontconfig-dev
sudo yum install libjpeg libpng12 libXrender libXext fontconfig
sudo yum install libjpeg libpng libXrender libXext fontconfig
wkhtmltopdf_linux_x86 -V
#=> wkhtmltopdf_linux_x86: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
sudo yum install libjpeg.so.8
#=> No package libjpeg.so.8 available.
Dependent libraries for 32-bit does not exist in the standard RPM repositories of CentOS.
I've tried creating a symlink, but it doesn't work:
ln -s /usr/lib/libjpeg.so.62 /usr/lib/libjpeg.so.8
wkhtmltopdf_linux_x86 -V
#=> /path/to/wkhtmltopdf_linux_x86: /usr/lib/libjpeg.so.8: version `LIBJPEG_8.0' not found (required by /path/to/wkhtmltopdf_linux_x86)
#=> /path/to/wkhtmltopdf_linux_x86: /lib/libc.so.6: version `GLIBC_2.15' not found (required by /path/to/wkhtmltopdf_linux_x86)
Do you have a solution?
The currently bundled version of wkhtmltopdf is v1.2.1. Since last week a lot of web hosts have disabled SSLv3 because of the POODLE attack.
wkhtmltopdf v1.2.1 (and earlier) still use SSLv3 by default. This has been changed in the current testing release (v1.2.2.testing).
I was having a look to create a patch with the updated (testing) binaries so we could use this pre version in our app right now (since we rely on assets deliverd over https with SSLv3 disabled). Is there any good way to update the bundled binaries? It seems that the osx one can be extracted from the pkg, but I have no idea how to do that for the linux binaries. One option is to start a vagrant box for each required release and extract the binary from there but would that be enough? It would be nice if there was some more information on how to udpate the binaries.
We'd like to include the MIT license in the project.
Currently the gem is using RUBY_PLATFORM
to get the OS, so it can pick the right binary. On JRuby, this is always "java", because it's the only way we can differentiate gems for our platform:
$ jruby -e 'p RUBY_PLATFORM'
"java"
This prevents commands from working:
$ wkhtmltopdf
RuntimeError: Invalid platform. Must be running linux or intel-based Mac OS.
<main> at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/wkhtmltopdf-0.1.2/bin/wkhtmltopdf:8
load at org/jruby/RubyKernel.java:1022
<main> at /Users/headius/projects/jruby/bin/wkhtmltopdf:23
However we do support the (arguably more reliable) RbConfig::CONFIG['host_os']
which should work the same way for you:
$ jruby -e 'p RbConfig::CONFIG["host_os"]'
"darwin"
Changing the bin script to use this value instead of RUBY_PLATFORM would allow the gem to work on JRuby:
$ wkhtmltopdf ; echo $?
0
--- lib/ruby/gems/shared/gems/wkhtmltopdf-0.1.2/bin/wkhtmltopdf 2019-04-26 11:06:09.000000000 -0500
+++ lib/ruby/gems/shared/gems/wkhtmltopdf-0.1.2/bin/wkhtmltopdf-old 2019-04-26 11:05:41.000000000 -0500
@@ -1,10 +1,8 @@
#!/usr/bin/ruby
-platform = RbConfig::CONFIG['host_os']
-
-if platform =~ /linux/
+if RUBY_PLATFORM =~ /linux/
executable = 'wkhtmltopdf_linux_386'
-elsif platform =~ /darwin/
+elsif RUBY_PLATFORM =~ /darwin/
executable = 'wkhtmltopdf_darwin_386'
else
raise "Invalid platform. Must be running linux or intel-based Mac OS."
π
Is there any chance you could build new version of the gem with the license and upload it to rubygems.org? Unfortunately I can't officially use this gem until then.
Do we need to use another gem or installing manually the new version ?
Thanks for your work.
Hello.
I am trying to install the gem. When I give
" gem install wkhtmltopdf_binary",
it gives me the error.
"NoMethodError: undefined method `size' for nil:NilClass" . And the installation files. Same when I try with bundler as well.
It would be nice to know what changes between two versions and at least if the version number follows semantic versioning...
I'm using docker image ruby:2.6.3-alpine and this gem didn't work. To work, you have to install by apk add wkhtmltopdf
From https://wkhtmltopdf.org/downloads.html I can see that OSX version comes in 32bit and 64bit .pkg
and can be extracted from it.
For linux, there are individual files for ubuntu and debian 32 and 64 bit, and I guess we can extract the binary out of one?
Can someone write a script or instructions on how to extract these?
I can help with a PR for 0.12.5
I saw the changelog that it was added support for Ubuntu 20.04, but there is no binaries for this version on bin directory and I am getting some errors, for now I am duplicating the version 18.04 -> 20.04 directly in gem directory.
The version for 16.04 works perfectly on Ubuntu 18.04 and 20.04 (at least the amd64), and debian binaries also should work for ubuntu, so I suggest using same binary for then instead of using a 15~17mb for each ubuntu/debian version, and adding a hash to define wich binary to use should do the work.
I'm hosting a website on PlatformSH which uses this gem to install the appropriate binary. It was updated to 0.12.6 and suddenly I got this error message:
Error generating document: Failed to generate PDF: /app/.global/gems/wkhtmltopdf-binary-0.12.6/bin/wkhtmltopdf:28:in `': undefined method `match?' for /deepin/:Regexp (NoMethodError) Did you mean? match from /app/.global/bin/wkhtmltopdf:22:in `load' from /app/.global/bin/wkhtmltopdf:22:in `'
No other code was changed apart from the binary version. I'm using a Drupal module called entity_print that uses the library phpwkhtmltopdf but the maintainer of that library did not think the issue was in that library but likely related to this gem.
Reverting to 0.12.5.4 fixed it for me.
Hello!
I'm trying to install Wkhtmltopdf on an Oracle Linux 7.8 (Fedora) Docker Container. After running
yum install xvfb -y
yum install libfontconfig -y
yum install wkhtmltopdf -y
Everything install fine. But then when I got to test wkhtmltopdf with wkhtmltopdf http://google.com google.pdf
I get a runtime error.
/opt/app/vendor/bundle/ruby/2.6.0/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf:45:in `<top (required)>': Invalid platform, must be running on Ubuntu 14.04/16.04/18.04 CentOS 6/7/8, Debian 8/9/10, or intel-based macOS (missing binary: /opt/app/vendor/bundle/ruby/2.6.0/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf_ol_7.8_amd64). (RuntimeError)
Details on OS
NAME="Oracle Linux Server"
VERSION="7.8"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.8"
PRETTY_NAME="Oracle Linux Server 7.8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:8:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.8
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.8
new version of gem much bigger than previous one
0.12.5 - November 07, 2019 (238 MB)
0.12.4 - June 11, 2018 (45.1 MB)
0.12.5 totally unreal use it on heroku
I am getting following error when during my application deployment on Amazon EC2. I tired upgrading the gem version to latest: 0.9.9.3. Still the same error persists. However, I could manually install the gem on EC2 instance using gem install command. Can you please confirm that this issue is related to AWS EC2 installation scripts alone? My other gems are installing fine though.
Gem::RemoteFetcher::FetchError: bad response backend read error 503 (https://rubygems.global.ssl.fastly.net/gems/wkhtmltopdf-binary-0.9.9.1.gem)
An error occurred while installing wkhtmltopdf-binary (0.9.9.1), and Bundler
cannot continue.
Make sure that gem install wkhtmltopdf-binary -v '0.9.9.1'
succeeds before
bundling.
ERROR: bundle install failed!
The version 0.12.5 is published in rubygems ( https://rubygems.org/gems/wkhtmltopdf-binary/versions/0.12.5 ) but it is not available in Github repo ( https://github.com/zakird/wkhtmltopdf_binary_gem/releases ) π
@michaelcollas and @unixmonkey has done some good work to the gem (amd64 support and upgraded the binaries to 0.9.9). Wouldn't it be nice to merge their work and push a new gem to RubyGems?
Recently was released the binary version for CentOS 8:
https://wkhtmltopdf.org/downloads.html
https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm
wkhtmltopdf/wkhtmltopdf#4519
wkhtmltopdf/packaging#40
wkhtmltopdf/wkhtmltopdf#4490
@unixmonkey @zakird Is it possible to release a version with CentOS 8 binary?
Is there any way we can make this work on Windows?
wkhtmltopdf
has Windows packages. Am I missing something here?
Invalid platform, must be running on Ubuntu 14.04/16.04/18.04 CentOS 6/7/8, Debian 8/9/10, or intel-based macOS
(missing binary: /shared/bundled_gems/ruby/2.5.0/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf_eygl_2016.06_amd64). (RuntimeError)
cat /etc/os-release:
NAME="Engine Yard Gentoo Linux"
ID=eygl
ID_LIKE=gentoo
VERSION_ID=2016.06
BUILD_ID=2016.06.018.final
PRETTY_NAME="Engine Yard Gentoo/Linux"
ANSI_COLOR="1;32"
HOME_URL="http://www.engineyard.com/"
SUPPORT_URL="https://support.cloud.engineyard.com/"
BUG_REPORT_URL="https://support.cloud.engineyard.com/
Our nfs server has been showing errors such as this:
rpc.mountd[2538]: authenticated mount request from OurNFSserver:864 for /homesrv/kalyptorisk.com (/homesrv)
rpc.mountd[2538]: can't stat exported dir /homesrv/kalyptorisk.com: No such file or directory
coming from servers using wkhtmltopdf_binary_gem
. This is most likely an upstream problem from an earlier version of https://github.com/wkhtmltopdf/wkhtmltopdf -- It looks like it has been fixed in version 0.12.4
Can you please add a link to this repo from ruby gems to help get to this issue tracker.
Missing binary forarchlinux/manjaro
Invalid platform, must be running on Ubuntu 14.04/16.04/18.04 CentOS 6/7/8, Debian 8/9/10, or intel-based macOS (missing binary: /home/yan/code/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf_manjaro__amd64
What do I need to make it workοΌ
Hey there!
I'm having trouble using this gem with capistrano. I'm getting this error:
Bundler::GemNotFound: Could not find wkhtmltopdf-binary-0.12.5.4 in any of the sources
Any clue as to what could be causing this or a way to fix it?
Issue description
When generating fillable PDF from an HTML form, the fields are not editable via Adobe Acrobat in versions >0.12.3.
Expected or desired behavior
That fields are fillable in the PDF document.
System specifications
wkhtmltopdf 0.12.3 (with patched qt)
platform/distribution and version :
MacOSX 10.15.x
My current solution is to pin the version to 0.12.3.
The stable release has been bumped to 0.12.1 and includes a number of important features. Is this a fairly straight-forward thing to build or is there a lot of leg-work involved?
The current release of this gem bundles 0.9.9 which dates from 2010.
@unixmonkey @zakird Hey guys!
A new release of wkhtmltopdf is out (0.12.6 -> https://github.com/wkhtmltopdf/wkhtmltopdf/releases/tag/0.12.6 ).
How to upgrade the gem to get this release? I can open a PR to contribute with it. I just need help about what steps I should follow hehe π π€
It would be nice to support Debian 10 as this is the latest stable since 6 July 2019.
This is now the default distro/version for the official ruby images >= 2.6.5 to there is likely to be high demand as people update their dependencies in the coming weeks and months.
Happy to start a pr but I assume that only the maintainer/s are trusted to commit new binary files?
I'm using Docker image ruby:2.4-alpine
and have installed this gem successful. I've found the binary files here /bundle/gems/wkhtmltopdf-binary-0.12.3.1/bin
but when I try to cd to that path and enter ./wkhtmltopdf
, and nothing to show. And I tried to change to Ubuntu
(Docker image ruby:2.4) and it worked by showing Usage
for wkhtmltopdf
with same steps above.
Could you please suggest me what I'm wrong? Thanks!
README should explain how to install gem, and what the binary's dependencies are depending on their distribution.
The main project page links to gemcutter.org, but that service was shuttered and rolled in with the main Rubygems site.
Link should be: https://rubygems.org/gems/wkhtmltopdf-binary
wkhtmltopdf http://www.google.com google.pdf
Loading pages (1/5)
2010-07-12 18:32:45.620 wkhtmltopdf_darwin_386[828] WARNING: _wrapRunLoopWithAutoreleasePoolHandler got kCFRunLoopExit, but there are no autorelease pools in the stack.
Could not allocate register file: 22
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin8.11.1]
mac osx tiger 10.4.11
It's time libpng12 can be updated to libpng16.
Heroku moved from libjpeg62 to libjpeg8 with the new cedar-14 stack, which now breaks the binary:
wkhtmltopdf_linux_amd64: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory
On attempt I found at solving this issue: acdcorp@d01271c
I'm currently trying to make use of the wicked_pdf
gem, however, I'm not using Rails. I installed the /wkhtmltopdf_binary_gem
but still don't see any binary in the bin
folder. Would it make sense to install this manually into bin
?
I see that the path is ~/.rvm/gems/ruby-2.5.3/gems/wkhtmltopdf-binary-0.12.4/bin/wkhtmltopdf
should I set the executable path to this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.