Merged
Conversation
Fixes #369 The problem we were hitting was because we were setting the viewport scale to 1 when rendering each of the PDF pages. As I was digging into this, I found this page, which describes exactly what's going on: http://stackoverflow.com/questions/35400722/pdf-image-quality-is-bad-using-pdf-js Basically, this is how it breaks down. We create a canvas element to render the PDF page onto, and it is set to the viewport height and width. Because many (most?) PDFs are rendered at a smaller resolution, what ends up happening is on higher resolution monitors we create a big canvas, but then render an image that isn't scaled to it right. This causes the pixels to get spread out and blurriness ensues. The fix is to set the scaling to "2". We played around with the 3-5 range and it looked good on high resolutions - but as soon as the same image was rendered on a smaller resolution screen things went south quick. 2 seems to be the right setting which straddles the fence between the bad and pretty good.
Contributor
|
Looks good! (The best fixes are the simplest ones!) |
This file contains hidden or 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
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.
Fixes #369
The problem we were hitting was because we were setting the viewport scale
to 1 when rendering each of the PDF pages. As I was digging into this, I
found this page, which describes exactly what's going on:
http://stackoverflow.com/questions/35400722/pdf-image-quality-is-bad-using-pdf-js
Basically, this is how it breaks down. We create a canvas element to render the
PDF page onto, and it is set to the viewport height and width. Because
many (most?) PDFs are rendered at a smaller resolution, what ends up
happening is on higher resolution monitors we create a big canvas, but then
render an image that isn't scaled to it right. This causes the pixels to
get spread out and blurriness ensues.
The fix is to set the scaling to "2". We played around with the 3-5 range
and it looked good on high resolutions - but as soon as the same image
was rendered on a smaller resolution screen things went south quick. 2
seems to be the right setting which straddles the fence between the bad
and pretty good.