Giter Site home page Giter Site logo

madnight / docker-alpine-wkhtmltopdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thinkdevcode/docker-alpine-wkhtmltopdf

155.0 6.0 69.0 63.03 MB

wkhtmltopdf alpine docker container with headless qt patches

Home Page: https://beuke.org/docker-alpine-wkhtmltopdf/

License: MIT License

Dockerfile 100.00%
wkhtmltopdf alpine-image qt-patches lightweight small docker travis-build mit-license

docker-alpine-wkhtmltopdf's Introduction

Alpine Wkhtmltopdf Docker Container

License: MIT Build Status

Usage

wkhtmltopdf with qt patches

yes, Alpine does have a wkhtmltopdf package... but it doesn't include the qt patches ... enjoy!

# i do it myself
docker build -t alpine-wkhtmltopdf .
docker run alpine-wkhtmltopdf google.com - > test.pdf

# i'm lazy
docker run madnight/docker-alpine-wkhtmltopdf google.com - > test.pdf

# or mount a local file (e.g. test.html)
docker run --rm -v $(pwd):/data madnight/docker-alpine-wkhtmltopdf /data/test.html - > test.pdf

Q&A

Is it really the smallest html to pdf docker image on the planet?

Yes.

docker-alpine-wkhtmltopdf's People

Contributors

alloylab avatar madnight avatar mulcek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

docker-alpine-wkhtmltopdf's Issues

alpine-wkhtmltopdf-builder:0.12.5-alpine3.10-606718795 : wkhtmltopdf (no such package)

Hello,

We have been using in the docker file like this
RUN apk add --no-cache wkhtmltopdf COPY --from=madnight/alpine-wkhtmltopdf-builder:0.12.5-alpine3.10-606718795 \ /bin/wkhtmltopdf /bin/wkhtmltopdf

However, today, we started getting this error on the build

ERROR: unable to select packages: wkhtmltopdf (no such package): required by: world[wkhtmltopdf]
I have tried

Please suggest the fix

Bad version of wkhtmltopdf in tag 0.12.5-alpine3.10

Hi,

I think you made a mistake regarding your tags.

If I docker pull the tag:

  • 0.12.5-alpine3.10-3660174986, I get wkhtmltopdf 0.12.6
  • 0.12.5-alpine3.10, I get wkhtmltopdf 0.12.6
  • 0.12.5-alpine3.10-3550361538, I get wkhtmltopdf 0.12.6
  • 0.12.5-alpine3.10-3543388771, I get wkhtmltopdf 0.12.5

image

Alpine 3.11 tag on Docker hub

Hello,

Is it possible to release a tag for Alpine 3.11 on docker hub so we can run code such as
COPY --from=madnight/docker-alpine-wkhtmltopdf:alpine-3.11 /bin/wkhtmltopdf /bin/wkhtmltopdf in our builds?

The latest tag currently there is madnight/docker-alpine-wkhtmltopdf:alpine-3.10 from 7 months ago.

Script the compilation of wkhtmltopdf

It would be better if the compilation of wkhtmltopdf was included in the repository.

The compilation could happen in a separate container using a multistage build. The resulting container would only contain the compiled binary.

wkhtmltopdf 0.12.6

Hi,

Could you update your latest image with wkhtmltopdf 0.12.6?
This is very handy.

Problem with metric CSS dimensions

For PDF styling I use cm dimensions in my CSS which usually works fine.

But the version from the docker-alpine-wkhtmltopdf image somehow seems to scale up the dimenions by some factor.

Here's a simple example:

<!DOCTYPE html>
<html><head>
<style>
body {
    border: 1px solid red;
    margin:         0;
    padding:        0;
    width:          20cm;
    height:         29cm;
}
</style>
</head>
<body>
</body></html>

The default page size A4 is roughly 29.7 cm by 21 cm. So the following command should render a red bordered box on that fits on the page:

wkhtmltopdf --no-outline \
  --encoding 'UTF-8' \
  --margin-top '0' \
  --margin-right '0' \
  --margin-bottom '0' \
  --margin-left '0' \
  --disable-smart-shrinking \
  test.html test.pdf

The correct result with wkhtmltopdf 0.12.5 on my Ubuntu box:

a4_border_correct

And this is the result with the docker-alpine image. The red box exceeds the A4 page to the right and to the bottom and continues on a second page.

a4_border_incorrect

My docker build -t alpine-wkhtmltopdf . failed

Sending build context to Docker daemon 34.82kB
Step 1/7 : FROM alpine:3.10
---> 965ea09ff2eb
Step 2/7 : MAINTAINER Fabian Beuke [email protected]
---> Using cache
---> 030f10a94fe5
Step 3/7 : RUN apk add --update --no-cache libgcc libstdc++ libx11 glib libxrender libxext libintl ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family
---> Using cache
---> df8019352057
Step 4/7 : COPY --from=madnight/alpine-wkhtmltopdf-builder:0.12.5-alpine3.10 /bin/wkhtmltopdf /bin/wkhtmltopdf
---> Using cache
---> 84081596742b
Step 5/7 : ENV BUILD_LOG=https://api.travis-ci.org/v3/job/585241708/log.txt
---> Using cache
---> a1ee00a4ad70
Step 6/7 : RUN [ "$(sha256sum /bin/wkhtmltopdf | awk '{ print $1 }')" == "$(wget -q -O - $BUILD_LOG | sed -n '14121p' | awk '{ print $1 }')" ]
---> Running in 056655fdbb3c
The command '/bin/sh -c [ "$(sha256sum /bin/wkhtmltopdf | awk '{ print $1 }')" == "$(wget -q -O - $BUILD_LOG | sed -n '14121p' | awk '{ print $1 }')" ]' returned a non-zero code: 1

zsh: no such file or directory: /lib/ld-musl-x86_64.so.1

Hi ! I am currently trying to use wkhtmltopdf on a docker container with image php:8.1.0RC1-fpm-alpine3.13.
To do so I added COPY --from=madnight/docker-alpine-wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf to my Dockerfile but when I tried to run the command wkhtmltopdf http://google.com test.pdf I get this error zsh: no such file or directory: /lib/ld-musl-x86_64.so.1.
When I check this /lib I see that I have this file instead /lib/ld-musl-aarch64.so.1.
I have no idea how to fix this.

When I ran docker run madnight/docker-alpine-wkhtmltopdf:latest google.com - > test.pdf it works perfectly

Thanks in advance for your help

Edit:
I had to change the platform of my php container with platform: linux/x86-64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.