We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In build v55.0b1 a feature to generate reproducible PDFs was added.
SOURCE_DATE_EPOCH is set to 0
With the following python code
from weasyprint import HTML, CSS import hashlib html = """ <html> <head> <title>Hello World</title> <meta name="dcterms.created" content="2002-01-01"> </head> <body> <p>Foobar</p> </body> </html> """ css = """ body { color: #515151; } """ pdf = HTML(string=html).write_pdf(stylesheets=[CSS(string=css)]) md5 = hashlib.md5(pdf).hexdigest() print(md5)
It runs correctly and outputs the hash 92ae45e4db7a51b1941cd98e8b4c1c8b consistently
92ae45e4db7a51b1941cd98e8b4c1c8b
But when I add a background-image to the body like so:
body
from weasyprint import HTML, CSS import hashlib html = """ <html> <head> <title>Hello World</title> <meta name="dcterms.created" content="2002-01-01"> </head> <body> <p>Foobar</p> </body> </html> """ css = """ body { color: #515151; background-image: url("https://i.imgur.com/o3v4JUp.png"); } """ pdf = HTML(string=html).write_pdf(stylesheets=[CSS(string=css)]) md5 = hashlib.md5(pdf).hexdigest() print(md5)
The output changes with every pass.
1#: bc1c85fdaa77406c185dcab8a94e0602 2#: 88f96791669a895f2a4ff7315613d5d1 3#: c6cc5cf67671110b9c4b64d83f16d263
I also tried to add a base64 background like so:
css = """ body { color: #515151; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAMSURBVBhXY/j//z8ABf4C/qc1gYQAAAAASUVORK5CYII=') } """
Which results it the same behavior
The text was updated successfully, but these errors were encountered:
00d5b03
Hi, and thanks a lot for this bug report!
The problem comes from the hash() function that’s not stable. Using md5 instead works well.
hash()
Unfortunately, I didn’t find a nice way to test this. If anyone has a good idea, don’t hesitate to open a PR!
Sorry, something went wrong.
py-weasyprint: Update to 56.0.
cd63ab5
Version 56.0 ------------ Released on 2022-07-07. This version also includes the changes from unstable b1 version listed below. New features: * `70f9b62 <https://github.com/Kozea/WeasyPrint/commit/70f9b62>`_: Support format 5 for bitmap glyphs Bug fixes: * `1666 <https://github.com/Kozea/WeasyPrint/issues/1666>`_ Fix reproducible PDF generation with embedded images * `1668 <https://github.com/Kozea/WeasyPrint/issues/1668>`_: Fix @page:nth() selector * `3bd9a8e <https://github.com/Kozea/WeasyPrint/commit/3bd9a8e>`_: Don’t limit the opacity groups to the original box size * `cb9540b <https://github.com/Kozea/WeasyPrint/commit/cb9540b>`_, `76d174f <https://github.com/Kozea/WeasyPrint/commit/76d174f>`_, `9ce6547 <https://github.com/Kozea/WeasyPrint/commit/9ce6547>`_: Minor bugfixes for split table rows
No branches or pull requests
In build v55.0b1 a feature to generate reproducible PDFs was added.
SOURCE_DATE_EPOCH is set to 0
With the following python code
It runs correctly and outputs the hash
92ae45e4db7a51b1941cd98e8b4c1c8b
consistentlyBut when I add a background-image to the
body
like so:The output changes with every pass.
I also tried to add a base64 background like so:
Which results it the same behavior
The text was updated successfully, but these errors were encountered: