wkhtmltopdf_binary_gem icon indicating copy to clipboard operation
wkhtmltopdf_binary_gem copied to clipboard

Binary for Debian 9 Arm64

Open pedrofurtado opened this issue 4 years ago • 9 comments

Closes #121

@unixmonkey 🤝 🤓

PS: Binary extracted and gzipped from official site of Wkhtmltopdf 🥇

pedrofurtado avatar Sep 27 '21 19:09 pedrofurtado

@stanBienaives Can you help us, testing this binary in your debian 9 arm64, to confirm if it is working well? 👍 I don't have a mac M1 😆

pedrofurtado avatar Sep 27 '21 19:09 pedrofurtado

Yes I'll do that tmrw morning

stanBienaives avatar Sep 27 '21 19:09 stanBienaives

👋 @pedrofurtado

I tested the binary with the container ruby:2.6.1 (arm64 build) on my M1 machine and it worked fine with the command .bin/wkhtmltopdf www.google.fr test.pdf

Do you need more info ? I'll be happy to test other distro on arm64 in the future if needed.

stanBienaives avatar Sep 28 '21 06:09 stanBienaives

I tested it in my Gemfile with gem "wkhtmltopdf-binary", git: "https://github.com/pedrofurtado/wkhtmltopdf_binary_gem", ref: "fcab0b766054bc41b2aeac71ff2d687d951bae74" with a ruby:3.0.2-slim-buster (arm64 build) container on M1 Pro, and it fails with the error:qemu-i386: Could not open '/lib/ld-linux.so.2': No such file or directory.

In the container, the command /usr/local/bundle/bin/wkhtmltopdf -v gives me the error:

/usr/local/bundle/bin/wkhtmltopdf -v
/usr/local/lib/ruby/3.0.0/rubygems.rb:281:in `find_spec_for_exe': can't find gem wkhtmltopdf-binary (>= 0.a) with executable wkhtmltopdf (Gem::GemNotFoundException)
	from /usr/local/lib/ruby/3.0.0/rubygems.rb:300:in `activate_bin_path'
	from /usr/local/bundle/bin/wkhtmltopdf:23:in `<main>'

Installing it from wkhtmltopdf.org, as suggested in https://github.com/zakird/wkhtmltopdf_binary_gem/issues/121, works for me perfect!

RUN  DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends --no-install-suggests \
    ...
    libxrandr2 \
    ... 
    xfonts-75dpi \
    xfonts-base && \
    curl -L -o wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_$ARCH.deb && \
    dpkg -i ./wkhtmltopdf.deb && \
    rm wkhtmltopdf.deb && \
    ...

And then, it works! Notes the libs it depends on (only for slim-buster?)!

/usr/local/bin/wkhtmltopdf www.google.fr test.pdf
Loading pages (1/6)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

Also, tests are running in container as expected.

viktorianer avatar Nov 19 '21 16:11 viktorianer

Here's a Dockerfile snippet similar to the above that autodetects architecture and Debian codename, and doesn't require manual dependency installation:

RUN WK_VERSION=0.12.6-1 \
    && ARCH=$(dpkg --print-architecture) \
    && CODENAME=$(. /etc/os-release; echo $VERSION_CODENAME) \
    && curl -LSfso wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/$WK_VERSION/wkhtmltox_$WK_VERSION.${CODENAME}_$ARCH.deb \
    && apt-get -q update \
    && apt-get install -qy ./wkhtmltopdf.deb \
    && rm -r wkhtmltopdf.deb /var/lib/apt/lists/*

encounter avatar Jan 14 '22 21:01 encounter

@unixmonkey Hi! 👋

I think we are ready to merge ✅

pedrofurtado avatar Feb 14 '22 17:02 pedrofurtado

Hey! Can we get this merged? Can't use wickedpdf y arm64 beacuse of the lack of this. Thanks!

gaspo53 avatar Mar 22 '23 12:03 gaspo53

@gaspo53 Why not? Add It to your Gemfile like this:

git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'wkhtmltopdf_binary_gem', github: 'pedrofurtado/wkhtmltopdf_binary_gem',
  branch: 'debian-9-arm64', ref: 'fcab0b766054bc41b2aeac71ff2d687d951bae74'

unixmonkey avatar Mar 22 '23 13:03 unixmonkey

@unixmonkey thanks!

gaspo53 avatar Mar 22 '23 14:03 gaspo53

Thank you! Although I didn't merge this specific PR, these Debian binaries are now in version 0.12.6.7 (from this PR). Please check it and make sure it works for you.

unixmonkey avatar May 10 '24 02:05 unixmonkey

@unixmonkey thanks!

gaspo53 avatar May 10 '24 02:05 gaspo53