Giter Club home page Giter Club logo

Comments (17)

chdanielmueller avatar chdanielmueller commented on August 26, 2024

Hi @tsadiq,
Could you maybe add two examples of PDFs (one with failure + one of what you would expect)?
I'm currently unaware of any issues in that regard. But maybe I can help you if I see the issue.
Thanks,
Daniel

from docker-wkhtmltopdf.

tsadiq avatar tsadiq commented on August 26, 2024

Sure, here they are. I just noticed while uploading them that the file made with the patched version is only 25kb in weight, while the other is above 300kb. Could it be that the css file wasn't downloaded? That could explain the lack of proper rendering (and the absence of QUrl error message 🤔)

wk-patched.pdf
wk-unpatched.pdf

from docker-wkhtmltopdf.

chdanielmueller avatar chdanielmueller commented on August 26, 2024

I don't know how the HTML for your file looks, but there are some background-colors in there.
Therefore I suppose the CSS gets loaded.

Maybe there is an issue with the page width or linebreaks.
Does the page look okay if opened in a browser?

Maybe you could set the wkhtmltopdf setting "disable-smart-shrinking" to true.
This helped with layout issues for my PDFs.

from docker-wkhtmltopdf.

tsadiq avatar tsadiq commented on August 26, 2024

I did try but the result is the same, it just renders bigger than before. That was a nice try tho, thanks for the idea! :D

from docker-wkhtmltopdf.

tsadiq avatar tsadiq commented on August 26, 2024

I ended up inlining all the css libs inside my html and i don't have any error with the unpatched version anymore so i guess this will close the topic for now... Until i need actual footers, then i think i'll give another try!

But for reference, the patched version still can't render my html properly, even with inlined css. That's pretty unnerving.

from docker-wkhtmltopdf.

teohhanhui avatar teohhanhui commented on August 26, 2024

Perhaps if you could share the HTML and CSS, others can identify what's going on?

from docker-wkhtmltopdf.

tsadiq avatar tsadiq commented on August 26, 2024

I can, if you feel like having a try at it ^^ I took this out of my docker /tmp, i just renamed it to .txt because github doesn't like html attachments
origin.txt

Also, here is the pdf i made using the above file by using the full docker image i built from this repo
result.pdf

The image is obviously missing but i don't think this is an issue

from docker-wkhtmltopdf.

chdanielmueller avatar chdanielmueller commented on August 26, 2024

I'm going to keep the issue open. Maybe I (or someone else) has time to take a look at it.

from docker-wkhtmltopdf.

tsadiq avatar tsadiq commented on August 26, 2024

As you see fit ^^ I might come back to it sooner or later (as i said, footers 👌) but in the meantime i can't help but thinking something went wrong during the image build and my binary is somehow broken.

from docker-wkhtmltopdf.

teohhanhui avatar teohhanhui commented on August 26, 2024

@tsadiq Actually I don't understand why you're building the image yourself when you could just copy the binary?

from docker-wkhtmltopdf.

teohhanhui avatar teohhanhui commented on August 26, 2024

Anyway, I confirm that I can reproduce the problem with something like this:

$ docker run --rm -v "$HOME/Downloads/test:/root/test"  --name wkhtmltopdf surnet/alpine-wkhtmltopdf:3.9-0.12.5-small 'file:///root/test/test.html' /root/test/test.pdf

from docker-wkhtmltopdf.

teohhanhui avatar teohhanhui commented on August 26, 2024

FWIW, it does render correctly with athenapdf:

$ docker run --rm -v "$HOME/Downloads/test:/converted" --name athenapdf arachnysdocker/athenapdf athenapdf /converted/test.html

But that's ~100% slower.

from docker-wkhtmltopdf.

tsadiq avatar tsadiq commented on August 26, 2024

@teohhanhui probably because i like to make things complicated, i guess ¯\ _(ツ) _/¯

from docker-wkhtmltopdf.

chdanielmueller avatar chdanielmueller commented on August 26, 2024

@tsadiq I was able to at least get a "better" layout by removing the legacy display:-webkit-box; and display:-webkit-inline-box;
res.pdf

Maybe there are other settings like this in your css which cause the layout to be broken.

from docker-wkhtmltopdf.

chdanielmueller avatar chdanielmueller commented on August 26, 2024

Closing this issue for now as it does not seem to be an issue with the image itself but css styles.
@tsadiq Please keep in mind that wkhtmltopdf uses the webkit engine and therefore legacy tags can cause issues.

from docker-wkhtmltopdf.

tsadiq avatar tsadiq commented on August 26, 2024

Oh hey i missed these answers sorry ^^ I think i'ma rework this whole html file with very basic html /css because that subcontractor did a serious pile of crap here. Thanks again for your time 👌

from docker-wkhtmltopdf.

tsadiq avatar tsadiq commented on August 26, 2024

Hey, just to let you know, with clean css and reworked html, things are much better and i can use the binary of your last version with footers and pages!

Thanks for your work and your time 👍

from docker-wkhtmltopdf.

Related Issues (20)

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.