Giter Site home page Giter Site logo

Comments (4)

agrahn avatar agrahn commented on June 15, 2024 1

Even better: I found out that the correct way to crop PDF pages is to add a /CropBox entry with the new bbox rect coords to the page dictionary and to leave the /MediaBox entry untouched. The lower left coordinates of the then visible area do not get translated to (0,0) by gs. As a result, pdffile behaves as expected when evaluating the provided bbox options. Nothing needs to be changed/fixed.

I updated cropped.pdf accordingly, and typesetting the code example above now produces the desired result. Thus, #231 is indeed a non-issue. 🎉

from dvisvgm.

mgieseki avatar mgieseki commented on June 15, 2024

Unfortunately, this seems to be a bit more complicated. As far as I can tell, Ghostscript and probably also mutool transform the page coordinates so that the lower left corner of the MediaBox is always located at (0,0). As a result, clipping to the original MediaBox coordinates given in the PDF can lead to undesired results.
I'll have a look if I can apply additional translations to adapt the behavior of psfile and pdffile. Since I haven't much time at the moment, this might take a few weeks, though.

from dvisvgm.

agrahn avatar agrahn commented on June 15, 2024

I am going to solve this at the TeX level. The dvisvgm.def graphics driver uses the extractbb command to retrieve the file's MediaBox/CropBox coordinates from the PDF and it is easy to perform the translations based on this. So maybe we can close this issue for now.

from dvisvgm.

mgieseki avatar mgieseki commented on June 15, 2024

Ok, great. Thank you for taking care of this. One less issue I have to fix. 😃

from dvisvgm.

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.