Skip to content
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

Document what the unit is for page dimensions #1531

Open
faltenberg opened this issue Oct 23, 2023 · 2 comments
Open

Document what the unit is for page dimensions #1531

faltenberg opened this issue Oct 23, 2023 · 2 comments

Comments

@faltenberg
Copy link

Describe your idea

In src/api/sizes.ts the A4 page format is defined with the dimension of 595.28 x 841.89. But what are the units? It is definitely not millimeters, nor is that in inches. When using addPage() we can specify the page dimensions as well. But in which units is that expressed?

Proposal to at least add that information to the documentation or support human-understandable standard units like millimeters or inches, similar to what jspdf-lib does.

How could this be implemented?

The documentation would need to be improved with the deeper insights.

What problem are you trying to solve?

I try to better understand where items end up on the PDF page so I can easily add some exact margin for page headers, page content and page footers.

Why does this matter to you?

When working with normal A4 paper I know the sizes and can easily setup things like 2cm margins. With the units in this library that are not documented nor intuitive I struggle to understand the relationship of the underlying units to the paper size.

Would others find this helpful?

I strongly believe that an improved documentation would help others just the same. It is a fundamental information.

Are you interested in implementing your proposal?

Yes

Why are you submitting a proposal?

I would like if the people with deep insight into this library could provide a documentation. A change of page sizes to standard units would be desired, however, I understand that there are more important issues to fix and features to implement.

Additional Notes

No response

@ctison
Copy link

ctison commented Nov 4, 2023

As stated in this page:

Space in a PDF file, also known as user space, is measured in PDF units. The PDF specification defines PDF units as 72 PDF units to 1 inch.

And 1 inch is equal to 2.54 centimeters.

@lookus69
Copy link

As stated in this page:

Space in a PDF file, also known as user space, is measured in PDF units. The PDF specification defines PDF units as 72 PDF units to 1 inch.

And 1 inch is equal to 2.54 centimeters.

Thanks for the info!
wouldnt it be great to find that on the official docs?
i dont know how to upvote this issue, but would be pretty useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants