savePDF
現在のブラウジングコンテキストのページを、お使いのOS上のPDFファイルに出力します。
使い方
browser.savePDF(filepath, { orientation, scale, background, width, height, top, bottom, left, right, shrinkToFit, pageRanges })
パラメータ
名前 | 型 | 詳細 |
---|---|---|
filepath | 文字列 | 生成されたPDFへのパス(.pdf サフィックスは必須)実行ディレクトリからの相対パス |
options オプション | PDFPrintOptions | PDF出力オプション |
options.orientation オプション | 文字列 | PDFページの向き |
options.scale オプション | 数値 | PDFページのスケール |
options.background オプション | 真偽値 | PDFページの背景を含める |
options.width オプション | 数値 | PDFページの幅 |
options.height オプション | 数値 | PDFページの高さ |
options.top オプション | 数値 | PDFページの上部パディング |
options.bottom オプション | 数値 | PDFページの下部パディング |
options.left オプション | 数値 | PDFページの左パディング |
options.right オプション | 数値 | PDFページの右パディング |
options.shrinkToFit オプション | 真偽値 | ページをページに合わせて縮小する |
options.pageRanges | 配列[オブジェクト] | PDFに含めるページの範囲 |
例
savePDF.js
it('should save a PDF screenshot of the browser view', function () {
await browser.savePDF('./some/path/screenshot.pdf');
});