Code Monkey home page Code Monkey logo

Comments (6)

nicoddemus avatar nicoddemus commented on July 18, 2024

Forgot to post the image.svg file to help reproduce the issue:
image.zip

from svglib.

deeplook avatar deeplook commented on July 18, 2024

I'm on vacation this week and can't test well. But I do remember vaguely having seen some kind of creation timestamps added by reportlab to the PDFs inside the info dict sessions. Svglib doesn't do anything special here and I would maybe suggest raising an issue on the reportlab repo on bitbucket.org.

from svglib.

nicoddemus avatar nicoddemus commented on July 18, 2024

@deeplook thanks for the answer.

But I do remember vaguely having seen some kind of creation timestamps added by reportlab to the PDFs inside the info dict sessions.

That makes sense, but I notice that we don't have the same problem when generating PDF with static images (png, jpg), tables or formatted text, only when we have a SVG file.

I will dig around the code to see if I encounter the reason for it.

Thanks again for your answer, and I hope you enjoy your vacation! πŸ‘ 🍺

from svglib.

replabrobin avatar replabrobin commented on July 18, 2024

We have made some improvements in reproducibility of the reportlab code. We now try to support the SOURCE_DATE_EPOCH environment variable; there is also the rl_config.invariant flag which may be used to make certain bits of reportlab more reproducible. However, as you discovered the random hashing introduced recently means that dictionary order is no longer constant.

from svglib.

nicoddemus avatar nicoddemus commented on July 18, 2024

@replabrobin thanks for info.

However, as you discovered the random hashing introduced recently means that dictionary order is no longer constant.

Indeed, but now that dicts in Python 3.6 are ordered, this might no longer be an issue in that Python version. I will check this and report back with what I find.

from svglib.

nicoddemus avatar nicoddemus commented on July 18, 2024

Hi,

Indeed with Python 3.6 the problem goes away: svglib now always generates the same image files in separate executions (albeit different from files generated in Python 2.7). This indicates that the suspicion about the problem being the random order of dicts in Python>3,<3.6 is correct.

For my purposes it is sufficient to use Python 3.6 and upwards now that Python dicts will always preserve order, so this can be closed from my POV.

from svglib.

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.