Skip to content

Conversation

@kevin-lynch
Copy link

@kevin-lynch kevin-lynch commented Oct 8, 2020

Set ratio to 1. Any other value causes unexpected alignment issues of the annotation layer, specifically some instances in windows 10 google chrome. Tested on multiple devices, this fix has no issues.

var pageRotate = (pdfPage.rotate === undefined ? 0 : pdfPage.rotate) + (rotate === undefined ? 0 : rotate);

var scale = canvasElt.offsetWidth / pdfPage.getViewport({ scale: 1 }).width * (window.devicePixelRatio || 1);
var scale = canvasElt.offsetWidth / pdfPage.getViewport({ scale: 1 }).width * 1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably not going to be merged as the owner doesn't seem to be active on this package.

However, there is no point to multiply by 1, if window.devicePixelRatio is creating problems you might just remove the multiplication.

so instead of * 1 you just write:

var scale = canvasElt.offsetWidth / pdfPage.getViewport({ scale: 1 }).width
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your input. I did try this originally and it didn't always fix the issue in some edge cases. 1 is the second condition, it multiplies by window.devicePixelRatio if the relevant condition is met.

@andorfermichael
Copy link

@FranckFreiburger would be really great if this issue would be fixed.

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

Labels

None yet

3 participants