Giter VIP home page Giter VIP logo

Comments (6)

SimonSapin avatar SimonSapin commented on May 31, 2024

I don’t understand, could you give an example?

from weasyprint.

meunierd avatar meunierd commented on May 31, 2024

If I use @page { size: A4; @bottom-left { content: url(someimage)}}

the size of the footer is not included and you get a warped page that when you try to print will scale down to A4 resulting in a lot of white space. If you don't scale fit-to-page the footer disappears altogether.

I've had some success specifying exact dimensions (eg size: 8.5in 11in;) This PDF looks fine when renderered and printed, but when printing fit-to-page you still get the same whitespace issues, where I'd expect them to look identical.

from weasyprint.

SimonSapin avatar SimonSapin commented on May 31, 2024

Well, this is as expected by the spec: http://dev.w3.org/csswg/css3-page/

The page margin is determined by the margin-* properties in @page and default to about 2cm. If you put too much content in a page-margin box, it overflows the page. You can change the margin like this:

@page { margin-bottom: 200px }

Another point is that, with content: url(…), the image always gets its intrinsic size. Using a background image instead and background-size could work around that.

from weasyprint.

meunierd avatar meunierd commented on May 31, 2024

But the image is fully visible so why scale?

from weasyprint.

SimonSapin avatar SimonSapin commented on May 31, 2024

Again I’m not sure what you’re talking about: scaling what? Please give more context.

In WeasyPrint, the page size in the PDF file is always exactly what you specify with @page { size: … } (and defaults to A4). Similarly for the page margins. If you have too much content for one page it will go on the next page or, if that is not possible for some reason, it will overflow the page.

I don’t know what "fit-to-page" is, but I can only assume that you are printing a PDF file to paper, and the PDF reader allows you to choose how to format stuff. I guess that "fit-to-page" means scaling so that everything (even what overflowed the virtual PDF page box) fits on the sheet of paper. This is out of scope for WeasyPrint. I have no control over what you do in a PDF reader.

Now, I was suggesting using background-size because the default resolution for images is 96dpi. For printing you might want to use a higher resolution. (Unless it’s SVG of course.)

Does that help?
You filed this as a bug report. Do you think there is a bug in WeasyPrint? What is the incorrect behavior, on which input, and what should it do instead?

from weasyprint.

SimonSapin avatar SimonSapin commented on May 31, 2024

Closing in absence of feedback. Please re-open or open a new issue as needed.

from weasyprint.

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.