Comments (41)
Hey to get this working in the mean time I used some of the dependencies mentioned in https://github.com/RoseRocket/docker-alpine-wkhtmltopdf-patched-qt
RUN apk --update --no-cache add \
wkhtmltopdf \
libgcc \
libstdc++ \
musl \
qt5-qtbase \
qt5-qtbase-x11 \
qt5-qtsvg \
qt5-qtwebkit \
ttf-freefont \
ttf-dejavu \
ttf-droid \
ttf-liberation \
ttf-ubuntu-font-family \
fontconfig
# Add openssl dependencies for wkhtmltopdf
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.8/main' >> /etc/apk/repositories && \
apk add --no-cache libcrypto1.0 libssl1.0
This now works for me on a base php:7.4.12-fpm-alpine
image.
It took a day of wondering around the internet to get this to work but it does now :)
Thanks @ashkulz for this librairie, it is awesome :)
from packaging.
yes I am, got behind with EOQ... just successfully compile 0.12.5 on alpine... https://git.alloylab.com/open-source/wkhtmltopdf/tags/0.12.5-070518 will submit PR on here
from packaging.
I guess I'll need to incorporate the musl changes into Qt as well, as I don't want to apply patches on the fly ... will try to look into it this weekend.
from packaging.
@alloylab: are you planning to make a PR for this?
from packaging.
@sir-gon or feel free to use https://github.com/Surnet/docker-wkhtmltopdf
from packaging.
0.12.6 is released already -- an alpine version will only happen for 0.12.7.
from packaging.
Any updates on this?
from packaging.
from packaging.
Any updates on release 0.12.6?
from packaging.
I think there's a few docker images linked above, I've yet to evaluate the patches ๐คทโโ๏ธ
from packaging.
@sir-gon See my Dockerfile for this : https://github.com/Opencomp/Dockerfiles/blob/master/wkhtmltopdf/Dockerfile
from packaging.
Hey to get this working in the mean time I used some of the dependencies mentioned in https://github.com/RoseRocket/docker-alpine-wkhtmltopdf-patched-qt
RUN apk --update --no-cache add \ wkhtmltopdf \ libgcc \ libstdc++ \ musl \ qt5-qtbase \ qt5-qtbase-x11 \ qt5-qtsvg \ qt5-qtwebkit \ ttf-freefont \ ttf-dejavu \ ttf-droid \ ttf-liberation \ ttf-ubuntu-font-family \ fontconfig # Add openssl dependencies for wkhtmltopdf RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.8/main' >> /etc/apk/repositories && \ apk add --no-cache libcrypto1.0 libssl1.0
This now works for me on a base
php:7.4.12-fpm-alpine
image.It took a day of wondering around the internet to get this to work but it does now :)
Thanks @ashkulz for this librairie, it is awesome :)
@ashkulz, would be helpful to hear your view on this approach. Am I opening a can of worms using this for a production env? Is it best to wait for .7 release?
It would be for creating a pull request on a Linux Server image to resolve this issue: linuxserver/docker-bookstack#80
from packaging.
Sorry for asking. But this could be very useful for what I am currently working on (alpine images with wkhtmltopdf for amd and arm processors), so... Is there any update on this? ๐
If you want your pdf look pixel perfect as in browser, just use a browser and some testing framework. Here is an example how to do this with puppeteer' https://futurestud.io/tutorials/node-js-create-a-pdf-from-html-with-puppeteer-and-handlebars
from packaging.
from packaging.
Any progress on this?
from packaging.
Oh pls! I i'm doing a lot of research for a headless solution for PDF generation and wkhtmltopdf is the best until now, but I have produced a huge docker image!
Alpine aproach would be perfect
from packaging.
@chdanielmueller @sir-gon But the font issue mentioned in the issue description still isn't fixedin the Surnet images, right? This makes those images only partially useful.
from packaging.
@mikehaertl That's right that issue is still open. A workaround is to use fonts loaded from the web. e.g. Google Fonts
@jtraulle Do you have any issues in your image with false fonts?
from packaging.
@chdanielmueller I don't think so. Try it a tell me ;)
from packaging.
I have not yet experienced any font issues. It is possible I may just be using my build on such a limited set of pages that I have not noticed it. I use a binary build for alpine:3.7 from https://github.com/madnight/docker-alpine-wkhtmltopdf and add fonts. My docker file is here: https://github.com/txn2/n2pdf/blob/master/Dockerfile
I use this pretty heavily in my txPdf project: https://imti.co/webpage-to-pdf-microservice/
from packaging.
Any progress so far? May we help with the pr?
from packaging.
from packaging.
Is there a guide how to compile wkhtmltopdf for other platforms (alpine) and a testing guide to see if the build is working or not?
from packaging.
Also, forgot about #20 by @anujith-singh -- it has the build system changes but I doubt it works because of the missing Qt patches.
from packaging.
Yes @ashkulz Qt patches are missing in it
from packaging.
I'm planning to release 0.12.6 in a week's time -- does someone have the capacity to work with me to integrate the Qt patches required for Alpine support? @alloylab was going to do that at one point of time -- if he or @chdanielmueller can help me integrate the patches so that they don't break something else, I'd really appreciate it ๐
from packaging.
@ashkulz The file linked below is a Dockerfile for alpine:10 which builds 0.12.6
https://github.com/Surnet/docker-wkhtmltopdf/blob/master/archive/alpine-wkhtmltopdf/Dockerfile_3.10-0.12.6-full
I hope this is enough reference for a official alpine package for 0.12.7
With alpine:11 and up we have an issue that we are not able to build without specifically setting g++ and stdlibc++ to use the version from alpine:10.
The issue is related to gcc9.
Please see the following discussions:
Surnet/docker-wkhtmltopdf#13
Surnet/docker-wkhtmltopdf#18
from packaging.
@chdanielmueller that's a common problem (affecting Ubuntu 20.04 and ArchLinux as well) -- I'll be solving that with a proper fix in Qt, the Q_FOREACH
fix looks to be correct.
My main concern is integrating the other patches in https://github.com/Surnet/docker-wkhtmltopdf/tree/master/conf -- I'd like to understand why each one is required, as they shouldn't cause a regression for some other platform. Do you have some script/process that you use for testing the resulting binary, so I can confirm if the patch is required at compile time or at runtime and adapt accordingly?
from packaging.
I did not include any automated tests.
You can run the following command to test a version you built without some of the patches.
docker run surnet/alpine-wkhtmltopdf:<version> google.com - > test.pdf
The patches are being applied here:
https://github.com/Surnet/docker-wkhtmltopdf/blob/a445546703648957459b9c673e9db2e637c5a4de/Dockerfile-alpine.template#L53
(or in any Dockerfile in the archive)
from packaging.
any update for this issues ?
i use image alpine
and wkhtmltopdf 0.12.5
look like is not patched with qt
from packaging.
@darmawan01 not really, I haven't had time to integrate the musl patches into patched Qt.
from packaging.
i really need for this qt support in alpine. when the 12.7 will release with alpine build patched qt ?
from packaging.
@Maggie0002, issue I faced that Chinese text is not being rendered without wqy-zenhei package.
Ref: https://stackoverflow.com/a/49085451/3880239
from packaging.
Anyone managed to achieve QT5 Webkit compatibility?
The Arch Linux package is bundled for that, so it includes CSS3 (Flex) Support.
I'm wondering there is a docker image / guide or anything out here.
Thanks!
from packaging.
Not really, haven't had the time to investigate the required Qt patches.
from packaging.
I would like to share some info which may help those who are still struggling with font issues. I'm not sure where the source of problem but it seems that it depends a lot on configuration of fontconfig. I have following test file:
<html>
<head>
<style>
@font-face {
font-family: "Arial Narrow";
src: url("arialn.ttf") format("truetype");
}
body { font-amily: "Arial" }
.narrow { font-family: "Arial Narrow" }
</style>
</head>
<body>
This text should be using Arial font.<br/>
<span class="narrow">This text should be using Arial Narrow font.</span><br/>
</body>
</html>
With docker image from https://github.com/Surnet/docker-wkhtmltopdf, if no fonts are installed, the pdf will have both lines with "Arial Narrow", which is reasonable. But if I install Arial in OS, the pdf will have both lines in Arial. Replace Arial with other font, it will have both lines in that font, ignoring completely the font-face in css.
Now if I extract the package fonts-urw-base35
from Ubuntu repo, copy files from /etc/fonts/config.d
and from /usr/share/fonts/opentype/urw-base35
over to my docker image and do fc-cache -f
, it starts to work correctly, each line with expected font. I guess the fallback configuration in config.d did the trick but I cannot confirm, it's good enough for me so I move on.
I also tested with ubuntu:focal, it had the same issue without the package fonts-urw-base35
, but works correctly with.
from packaging.
@huycn that sounds like more a fontconfig issue with the above docker image and not wkhtmltopdf? Thanks for the information, though!
from packaging.
Sorry for asking. But this could be very useful for what I am currently working on (alpine images with wkhtmltopdf for amd and arm processors), so... Is there any update on this? ๐
from packaging.
I already have existing applications that are using wkhtmltopdf. The only thing is that I would like to have it inside my alpine images for easier deployment and maintenance in general. So switching to another pdf renderer isn't really an option ๐
What I'm searching is either an up-to-date alpine image (amd and arm) or - even better - binary files for both architectures that I can just download and copy into my existing images
from packaging.
I already have existing applications that are using wkhtmltopdf. The only thing is that I would like to have it inside my alpine images for easier deployment and maintenance in general. So switching to another pdf renderer isn't really an option ๐
What I'm searching is either an up-to-date alpine image (amd and arm) or - even better - binary files for both architectures that I can just download and copy into my existing images
I don't think there is a up-to-date binary therefore also no image. If it would be it would be here.
But you might be able to find older versions, just search for it, I used to use one myself.
from packaging.
I'm using this and it doesn't seem to support JavaScript
from packaging.
Related Issues (20)
- Mahdi@
- Build for bionic and focal amd64 HOT 2
- linux ไธญ 'footer-center':'็ฌฌ[page]้กต๏ผๅ ฑ[topage]้กต', #่ฎพ็ฝฎ้กต็ ๏ผไธๆฏๆไธญๆ HOT 2
- Build failing HOT 2
- Wkhtmltox compiled using wrong libraries HOT 9
- Build for Ubuntu 22.04 HOT 2
- amazonlinux2_lambda for arm/graviton2 powered lambda HOT 1
- wkhtmltopdf not present in container HOT 1
- Release for amazonlinux2023 HOT 2
- How can I use the full version of wkhtmltopdf on Ubuntu 22.04 with s390x architecture? HOT 7
- Symfony 5 + knp_snappy - failed to load and blocked access errors HOT 1
- Docker build does not support selinux labels HOT 1
- Is `bookworm` support planned? HOT 5
- Consider hosting deb/rpm repos for packages. HOT 1
- Is there a 0.12.6.1-2 version for windows? HOT 3
- LCM and HCF type of content is not rendering properly in pdf HOT 3
- Error building for Amazon Linux 2023: QPageSetupWidget has no member named ... HOT 6
- Debian 12-1-0 HOT 1
- /src/qt/configure: 149: cmake: not found HOT 2
- Noob question: how do I build a package for my Linux server? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packaging.