make print resolution configurable via AppOptions
This commit is contained in:
parent
1421b2f205
commit
b85209f1fd
@ -233,6 +233,11 @@ if (typeof PDFJSDev === 'undefined' ||
|
||||
value: (typeof navigator !== 'undefined' ? navigator.language : 'en-US'),
|
||||
kind: OptionKind.VIEWER,
|
||||
};
|
||||
defaultOptions.printResolution = {
|
||||
/** @type {number} */
|
||||
value: 150,
|
||||
kind: OptionKind.VIEWER,
|
||||
};
|
||||
}
|
||||
|
||||
const userOptions = Object.create(null);
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import { CSS_UNITS, NullL10n } from './ui_utils';
|
||||
import { PDFPrintServiceFactory, PDFViewerApplication } from './app';
|
||||
import { AppOptions } from './app_options';
|
||||
import { URL } from 'pdfjs-lib';
|
||||
|
||||
let activeService = null;
|
||||
@ -26,7 +27,7 @@ function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
|
||||
let scratchCanvas = activeService.scratchCanvas;
|
||||
|
||||
// The size of the canvas in pixels for printing.
|
||||
const PRINT_RESOLUTION = 150;
|
||||
const PRINT_RESOLUTION = AppOptions.get('printResolution') || 150;
|
||||
const PRINT_UNITS = PRINT_RESOLUTION / 72.0;
|
||||
scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);
|
||||
scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);
|
||||
|
Loading…
Reference in New Issue
Block a user