zakird / wkhtmltopdf_binary_gem

Ruby gem containing easily installable access to wkhtmltopdf application
https://rubygems.org/gems/wkhtmltopdf-binary
Apache License 2.0
184 stars 346 forks source link

Binary for Debian 9 Arm64 #122

Closed pedrofurtado closed 6 months ago

pedrofurtado commented 3 years ago

Closes #121

@unixmonkey 🤝 🤓

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

pedrofurtado commented 3 years ago

@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 😆

stanBienaives commented 3 years ago

Yes I'll do that tmrw morning

stanBienaives commented 3 years ago

👋 @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.

viktorianer commented 3 years ago

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.

encounter commented 2 years ago

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/*
pedrofurtado commented 2 years ago

@unixmonkey Hi! 👋

I think we are ready to merge ✅

gaspo53 commented 1 year ago

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

unixmonkey commented 1 year ago

@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'
gaspo53 commented 1 year ago

@unixmonkey thanks!

unixmonkey commented 6 months ago

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.

gaspo53 commented 6 months ago

@unixmonkey thanks!