1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #14055 from Snuffleupagus/PDF_TO_CSS_UNITS

Add `PDF_TO_CSS_UNITS` to the `PixelsPerInch`-structure
This commit is contained in:
Tim van der Meij 2021-09-22 22:24:51 +02:00 committed by GitHub
commit 5254676ef3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 22 deletions

View file

@ -879,7 +879,7 @@ function getImageSmoothingEnabled(transform, interpolate) {
scale[0] = Math.fround(scale[0]);
scale[1] = Math.fround(scale[1]);
const actualScale = Math.fround(
((globalThis.devicePixelRatio || 1) * PixelsPerInch.CSS) / PixelsPerInch.PDF
(globalThis.devicePixelRatio || 1) * PixelsPerInch.PDF_TO_CSS_UNITS
);
if (interpolate !== undefined) {
// If the value is explicitly set use it.

View file

@ -18,6 +18,7 @@ import {
BaseException,
isString,
removeNullCharacters,
shadow,
stringToBytes,
Util,
warn,
@ -35,6 +36,11 @@ const SVG_NS = "http://www.w3.org/2000/svg";
const PixelsPerInch = {
CSS: 96.0,
PDF: 72.0,
/** @type {number} */
get PDF_TO_CSS_UNITS() {
return shadow(this, "PDF_TO_CSS_UNITS", this.CSS / this.PDF);
},
};
class DOMCanvasFactory extends BaseCanvasFactory {