|
@@ -1321,7 +1321,14 @@ Use `page-break-before: always;` CSS style to force to print to a new page.
|
|
|
Example usage:
|
|
|
|
|
|
```js
|
|
|
-const options = { silent: true, deviceName: 'My-Printer' }
|
|
|
+const options = {
|
|
|
+ silent: true,
|
|
|
+ deviceName: 'My-Printer',
|
|
|
+ pageRanges: {
|
|
|
+ from: 0,
|
|
|
+ to: 1
|
|
|
+ }
|
|
|
+}
|
|
|
win.webContents.print(options, (success, errorType) => {
|
|
|
if (!success) console.log(errorType)
|
|
|
})
|
|
@@ -1338,8 +1345,8 @@ win.webContents.print(options, (success, errorType) => {
|
|
|
default margin, 1 for no margin, and 2 for minimum margin.
|
|
|
* `scaleFactor` Number (optional) - The scale factor of the web page. Can range from 0 to 100.
|
|
|
* `pageRanges` Record<string, number> (optional) - The page range to print.
|
|
|
- * `from` Number - the first page to print.
|
|
|
- * `to` Number - the last page to print (inclusive).
|
|
|
+ * `from` Number - zero-based index of the first page to print.
|
|
|
+ * `to` Number - zero-based index of the last page to print (inclusive).
|
|
|
* `pageSize` String | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
|
|
|
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width` in microns.
|
|
|
* `printBackground` Boolean (optional) - Whether to print CSS backgrounds.
|