feat: allow defaulting to printer default page size (#49523)

Co-authored-by: Edvan de Matos <edvan.santos@querodelivery.com>
This commit is contained in:
Shelley Vohr
2026-02-13 13:40:14 +01:00
committed by GitHub
parent 3a5f9e0a33
commit dcdbb0397e
7 changed files with 162 additions and 65 deletions

View File

@@ -263,7 +263,12 @@ WebContents.prototype.print = function (options: ElectronInternal.WebContentsPri
throw new TypeError('webContents.print(): Invalid print settings specified.');
}
const { pageSize } = options;
const { pageSize, usePrinterDefaultPageSize } = options;
if (usePrinterDefaultPageSize !== undefined && pageSize !== undefined) {
throw new Error('usePrinterDefaultPageSize cannot be combined with pageSize');
}
if (typeof pageSize === 'string' && PDFPageSizes[pageSize]) {
const mediaSize = PDFPageSizes[pageSize];
options.mediaSize = {