Skip to main content
Version: 24.38.0

ScreenshotOptions 接口

🌐 ScreenshotOptions interface

语法

🌐 Signature

export interface ScreenshotOptions

属性

🌐 Properties

属性

🌐 Property

修饰符

🌐 Modifiers

类型

🌐 Type

描述

🌐 Description

默认

🌐 Default

captureBeyondViewport

optional

boolean

捕获视口之外的屏幕截图。

🌐 Capture the screenshot beyond the viewport.

如果没有 clip则为false。否则为 true`。

clip

optional

截图剪辑

指定要剪辑的页面/元素的区域。

🌐 Specifies the region of the page/element to clip.

encoding

optional

'base64' | 'binary'

图片的编码。

🌐 Encoding of the image.

'binary'

fromSurface

optional

boolean

从表面而不是视图捕获屏幕截图。

🌐 Capture the screenshot from the surface, rather than the view.

true

fullPage

optional

boolean

true 时,截取整个页面的屏幕截图。

🌐 When true, takes a screenshot of the full page.

false

omitBackground

optional

boolean

隐藏默认的白色背景并允许捕获透明的屏幕截图。

🌐 Hides default white background and allows capturing screenshots with transparency.

false

optimizeForSpeed

optional

boolean

false

path

optional

string

保存图片的文件路径。截图类型将从文件扩展名中推断。如果路径是相对路径,则相对于当前工作目录解析。如果未提供路径,图片将不会保存到磁盘。

🌐 The file path to save the image to. The screenshot type will be inferred from file extension. If path is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk.

quality

optional

number

图片质量,范围为0-100。不适用于png图片。

🌐 Quality of the image, between 0-100. Not applicable to png images.

type

optional

ImageFormat

'png'