Preflight Checklist
Electron Version
28.1.2
What operating system are you using?
Windows
Operating System Version
all
What arch are you using?
x64
Last Known Working Electron version
28.1.2
Expected Behavior
Electron.PrintToPDFOptions > Margins
web-contents.md, webview-tag.md file
#### `contents.print([options], [callback])`
### `<webview>.print([options])`
* `options` Object (optional)
* `margins` Object (optional)
* `marginType` string (optional) - Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen, you will also need to specify `top`, `bottom`, `left`, and `right`.
* `top` number (optional) - The top margin of the printed web page, in pixels.
* `bottom` number (optional) - The bottom margin of the printed web page, in pixels.
* `left` number (optional) - The left margin of the printed web page, in pixels.
* `right` number (optional) - The right margin of the printed web page, in pixels.
#### `contents.printToPDF(options)`
### `<webview>.printToPDF(options)`
* `options` Object
* `marginsToPDF` Object (optional)
* `top` number (optional) - Top margin in inches. Defaults to 1cm (~0.4 inches).
* `bottom` number (optional) - Bottom margin in inches. Defaults to 1cm (~0.4 inches).
* `left` number (optional) - Left margin in inches. Defaults to 1cm (~0.4 inches).
* `right` number (optional) - Right margin in inches. Defaults to 1cm (~0.4 inches).
Actual Behavior
The docs are different, the gn-typescript-definitions script only creates one 'Margins'.
interface WebContentsPrintOptions {
...
margins?: Margins;
...
}
interface PrintToPDFOptions {
...
margins?: Margins;
...
}
interface WebviewTagPrintOptions {
...
margins?: Margins;
...
}
interface Margins {
/**
* Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
* you will also need to specify `top`, `bottom`, `left`, and `right`.
*/
marginType?: ('default' | 'none' | 'printableArea' | 'custom');
/**
* The top margin of the printed web page, in pixels.
*/
top?: number;
/**
* The bottom margin of the printed web page, in pixels.
*/
bottom?: number;
/**
* The left margin of the printed web page, in pixels.
*/
left?: number;
/**
* The right margin of the printed web page, in pixels.
*/
right?: number;
}
Testcase Gist URL
No response
Additional Information
No response
Preflight Checklist
Electron Version
28.1.2
What operating system are you using?
Windows
Operating System Version
all
What arch are you using?
x64
Last Known Working Electron version
28.1.2Expected Behavior
Electron.PrintToPDFOptions > Margins
web-contents.md,webview-tag.mdfileActual Behavior
The docs are different, the
gn-typescript-definitionsscript only creates one 'Margins'.Testcase Gist URL
No response
Additional Information
No response