savePDF
Prints the page of the current browsing context to a PDF file on your OS.
Usage
browser.savePDF(filepath, { orientation, scale, background, width, height, top, bottom, left, right, shrinkToFit, pageRanges })
Parameters
| Name | Type | Details |
|---|---|---|
filepath | String | path to the generated pdf (.pdf suffix is required) relative to the execution directory |
optionsoptional | PDFPrintOptions | Print PDF Options |
options.orientationoptional | String | Orientation of PDF page |
options.scaleoptional | number | Scale of PDF page |
options.backgroundoptional | boolean | Include background of PDF page |
options.widthoptional | number | Width of PDF page |
options.heightoptional | number | Height of PDF page |
options.topoptional | number | Top padding of PDF page |
options.bottomoptional | number | Bottom padding of PDF page |
options.leftoptional | number | Left padding of PDF page |
options.rightoptional | number | Right padding of PDF page |
options.shrinkToFitoptional | boolean | Shrink page to fit page |
options.pageRanges | object[] | Range of pages to include in PDF |
Example
savePDF.js
it('should save a PDF screenshot of the browser view', function () {
await browser.savePDF('./some/path/screenshot.pdf');
});
Returns
- <Buffer>
return: screenshot buffer