Merge pull request #10898 from Snuffleupagus/firefox-print-resolution

Allow experimenting with the `printResolution` AppOption when printing with the built-in Firefox version
This commit is contained in:
Tim van der Meij 2019-06-11 23:42:03 +02:00 committed by GitHub
commit 7348275094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { AppOptions } from './app_options';
import { CSS_UNITS } from './ui_utils'; import { CSS_UNITS } from './ui_utils';
import { PDFPrintServiceFactory } from './app'; import { PDFPrintServiceFactory } from './app';
import { shadow } from 'pdfjs-lib'; import { shadow } from 'pdfjs-lib';
@ -22,7 +23,7 @@ function composePage(pdfDocument, pageNumber, size, printContainer) {
let canvas = document.createElement('canvas'); let canvas = document.createElement('canvas');
// The size of the canvas in pixels for printing. // 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; const PRINT_UNITS = PRINT_RESOLUTION / 72.0;
canvas.width = Math.floor(size.width * PRINT_UNITS); canvas.width = Math.floor(size.width * PRINT_UNITS);
canvas.height = Math.floor(size.height * PRINT_UNITS); canvas.height = Math.floor(size.height * PRINT_UNITS);