-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
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
Allow units for page size #2773
Open
nikischin
wants to merge
6
commits into
diegomura:master
Choose a base branch
from
nikischin:feature/pageSizeUnits
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: 0554c1d The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thank you for merging #2771 @diegomura, in addition I also merged the branch and prepared this PR. |
Merged
Could you have a look on this please @diegomura? Thank you so much! |
glarivie
approved these changes
Oct 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In addition to #2771 I also implemented the support for units
"in"
,"cm"
,"mm"
to the<Page/>
size
attribute.Includes the fixes for the dpi from #2771 already but had to be a bit rewritten.
implements #2008
fixes #2885
Some background about this and also #2771:
The PDF spec doesn't really have DPI and always expects the unit to be
user points
which always expects points in an PDF to be1/72 of an inch
. So any unitless value in a PDF always should be considered auser point
. The dpi setting then should represent auser unit
which defaults to72 dots per inch
and can change this conversion to anything else.Please check out more details to this here or here
The thing with PDF is, you always want to have a font set to 12pt to be the same size no matter what dpi setting you have. You can check on Adobe Indesign and create two pdfs, one with 72dpi and one with 300dpi, and in both the font will have the same size (relative to the page size) if set to 12pt (which equals 12 user points). This was not working before the fix and was therefore super confusing. Why should the complete layout of the page change when I change the dpi setting?
Please note that debug mode also represents the user points and not pixels.
Expected behavior
A page with
"A4"
will result in595 x 841
points no matter what dpi is setA page with
{{width: "210mm", height: "297mm"}}
will result in595 x 841
points no matter what dpi is setA page with
{{width: 595, height: 841 }}
will result in595 x 841
points no matter what dpi is setA page with
{{width: "595px", height: "841px" }}
will result in595 x 841
points on72 dpi
, but only142 x 202
points on300dpi
A element with a width of
590
points will almost fill the page for a A4 page no matter what dpiA element with a width of
"99vw"
will almost fill the page for a A4 page no matter what dpiA element with a width of
"590px"
will almost fill the page for a A4 page on 72dpi but will only fill about 1/4 or 1/5 on 300dpi