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

Width prop is not multiplied by given scale #322

Closed
3 tasks done
ghost opened this issue Dec 14, 2018 · 2 comments
Closed
3 tasks done

Width prop is not multiplied by given scale #322

ghost opened this issue Dec 14, 2018 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Dec 14, 2018

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues

Description

I found a strange behavior, which I'm not sure is a bug or simply the readme is out of sync with the latest release. From the readme,

If you define width and scale at the same time, the width will be multiplied by a given factor.

However, using the multi-page example from Wiki, when I supply both width (or height) and scale to <Page />, the scale seems to be ignored. In other words, the width does not get adjusted.

See this sandbox for a quick demo.

Steps to reproduce

  1. Use this template from wiki
  2. Pass both width and scale
<Page
  key={`page_${index + 1}`}
  pageNumber={index + 1}
  width={800}
  scale={2}
/>
  1. See the page doesn't get scaled

Expected behavior

The page width should be magnified x2 times.

Actual behavior

The page remains at the default scale of 1.0.

Additional information

Note that when scale is used on its own, i.e. without width or height, the page gets scaled, as expected. As a workaround, I have to apply the scale manually, e.g.

<Page
  key={`page_${index + 1}`}
  pageNumber={index + 1}
  width={800 * 2}
  scale={2}
/>

Also, same behavior with both canvas and svg renderMode.

Environment

  • Browser: any
  • React-PDF version: ^4.0.0
  • React version: ^16.6.3
  • Webpack version: ^4.27.1
@ghost
Copy link
Author

ghost commented Dec 19, 2018

@wojtekmaj Could I ask for your input on this? :-)

@wojtekmaj
Copy link
Owner

Hi, thanks for your report. This has been fixed - expect it to be out with the next release. Sorry for the delay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant