Re-factor the CSS_PIXELS_PER_INCH/PDF_PIXELS_PER_INCH exports (PR 13991 follow-up)

For improved maintainability, since these constants are being exposed in the official API, this patch moves them into an Object instead.
This commit is contained in:
Jonas Jenwald 2021-09-11 11:11:32 +02:00
parent bd51bbfd16
commit 0e54f568fb
7 changed files with 18 additions and 20 deletions

View file

@ -15,7 +15,7 @@
import {
AnnotationMode,
PDF_PIXELS_PER_INCH,
PixelsPerInch,
RenderingCancelledException,
shadow,
} from "pdfjs-lib";
@ -34,7 +34,7 @@ function composePage(
const canvas = document.createElement("canvas");
// The size of the canvas in pixels for printing.
const PRINT_UNITS = printResolution / PDF_PIXELS_PER_INCH;
const PRINT_UNITS = printResolution / PixelsPerInch.PDF;
canvas.width = Math.floor(size.width * PRINT_UNITS);
canvas.height = Math.floor(size.height * PRINT_UNITS);