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

Setting DPI changes page size #1953

Closed
jacobo opened this issue Jul 25, 2022 · 4 comments · Fixed by #2771
Closed

Setting DPI changes page size #1953

jacobo opened this issue Jul 25, 2022 · 4 comments · Fixed by #2771

Comments

@jacobo
Copy link

jacobo commented Jul 25, 2022

Describe the bug
I would expect that changing the DPI of PDF pages would not reflect as a change in inches/printed size (just higher resolution). But I am observing that that inches dimensions of PDFs does changes based on dpi.

To Reproduce

  1. render a pdf with e.g. <Page wrap dpi=300 orientation="landscape" size="Letter">
  2. Open PDF in OS X Preivew
  3. Choose Tools -> Show Inspect

Expected behavior
The PDF shows Page Size: 11 × 8.5 inches

Actual behavior
The PDF shows Page Size: 45.84 × 35.42 inches

Desktop (please complete the following information):

  • OS: MacOS
  • Browser chrome
  • React-pdf version 5.7.2
@ghost
Copy link

ghost commented Jul 26, 2022

I can not set the dpi in typescript. DPI prop is not there.

@NicolasPanda
Copy link

Any update on this bug ?

@nikischin
Copy link
Contributor

Unfortunately I have the same issue. So working with anything other than 72 dpi breaks the page dimensions in mm. This is caused by #1869 I guess. Could you have a look at it @diegomura? Thank you!

This was referenced Jun 2, 2024
@NicolasPanda
Copy link

I will try to explain what I understood and how I resolved my issue with DPI. A PDF doesn't really have DPI, as it is vector-based. However, you can include images inside it that are 300 DPI, and you will have a "300 DPI" PDF with the correct size in cm.

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

Successfully merging a pull request may close this issue.

3 participants