In your Gemfile
:
gem 'wkhtmltopdf-binary-edge-alpine', '~> 0.12.6.3', github: 'khalilgharbaoui/wkhtmltopdf-binary-edge-alpine'
Add this layer in your Dockerfile
:
# Install dependencies for wkhtmltopdf
RUN apk add --update --no-cache --wait 10 \
libstdc++ \
libx11 \
libxrender \
libxext \
libssl1.1 \
ca-certificates \
fontconfig \
freetype \
ttf-dejavu \
ttf-droid \
ttf-freefont \
ttf-liberation && \
apk add --update --no-cache --virtual .build-deps \
msttcorefonts-installer && \
# Install microsoft fonts
update-ms-fonts && fc-cache -f && \
# Clean up when done
rm -rf /tmp/* && apk del .build-deps
Extracted from surnet/alpine-wkhtmltopdf:3.15.0-0.12.6-small
docker image:
docker run --rm --entrypoint cat \
surnet/alpine-wkhtmltopdf:3.15.0-0.12.6-small \
/bin/wkhtmltopdf > ./libexec/wkhtmltopdf-alpine-linux-amd64
See: wkhtmltopdf release notes
Image is shrunk due to a zoom bug in the wkhtmltopdf binary version 0.12.5.0 when on Alpine Linux.
Workaround is to set the zoom:
to exacly 1.3
.
See: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4036
And also see: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4036#issuecomment-493812493
Please feel free to open a issue or pull request with suggestions.
Based upon the following repos: