mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat(page): add 'preferCSSPageSize' to page.pdf options (#2928)
Fixes #1963.
This commit is contained in:
committed by
Andrey Lushnikov
parent
78ebf401c2
commit
12e3510eca
@@ -889,6 +889,7 @@ class Page extends EventEmitter {
|
||||
const marginLeft = convertPrintParameterToInches(marginOptions.left) || 0;
|
||||
const marginBottom = convertPrintParameterToInches(marginOptions.bottom) || 0;
|
||||
const marginRight = convertPrintParameterToInches(marginOptions.right) || 0;
|
||||
const preferCSSPageSize = options.preferCSSPageSize || false;
|
||||
|
||||
const result = await this._client.send('Page.printToPDF', {
|
||||
landscape: landscape,
|
||||
@@ -903,7 +904,8 @@ class Page extends EventEmitter {
|
||||
marginBottom: marginBottom,
|
||||
marginLeft: marginLeft,
|
||||
marginRight: marginRight,
|
||||
pageRanges: pageRanges
|
||||
pageRanges: pageRanges,
|
||||
preferCSSPageSize: preferCSSPageSize
|
||||
});
|
||||
const buffer = Buffer.from(result.data, 'base64');
|
||||
if (options.path)
|
||||
|
||||
Reference in New Issue
Block a user