Comments (6)
I don’t understand, could you give an example?
from weasyprint.
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.
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.
But the image is fully visible so why scale?
from weasyprint.
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.
Closing in absence of feedback. Please re-open or open a new issue as needed.
from weasyprint.
Related Issues (20)
- Text clipped when using text-anchor="middle" HOT 2
- Weasyprint.exe : Fontconfig error: Cannot load default config file: No such file: (null) HOT 8
- Support of `@media only` HOT 4
- Migrate to resvg? HOT 2
- Support grid-auto-flow: column HOT 4
- Fonts breaking in v62 HOT 8
- Grid support enhancements
- v62 - TypeError: can't multiply sequence by non-int of type 'float' HOT 1
- Create single page pdf for thermal printer HOT 1
- Bold font sometimes work but sometimes doesn't HOT 2
- Grid support with errors (print-css-rocks) HOT 3
- PDF/UA accessibility. Labeled strange. HOT 1
- TypeError: can only concatenate str (not "float") to str (after update from 61.2 to 62.1) HOT 5
- Tailwind color codes are incompatible HOT 2
- Issue when trying to write a pdf with the openssl_md5 function in your library HOT 1
- Failure when building wheel for 62.1 from pypi HOT 5
- Add support for ol start attribute HOT 2
- Weasyprint (62.1) broken on macOS using Python 3.12.3 from python.org HOT 3
- python api: set created date HOT 3
- Support overflow-x/y HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weasyprint.