pub struct ScreenshotOptions {Show 19 fields
pub trace_id: Option<String>,
pub width: Option<u32>,
pub height: Option<u32>,
pub clip: Option<bool>,
pub format: Option<ImageFormat>,
pub quality: Option<u8>,
pub omit_background: Option<bool>,
pub optimize_for_speed: Option<bool>,
pub wait_delay: Option<Duration>,
pub wait_for_expression: Option<String>,
pub emulated_media_type: Option<MediaType>,
pub cookies: Option<Vec<Cookie>>,
pub skip_network_idle_events: Option<bool>,
pub user_agent: Option<String>,
pub extra_http_headers: Option<HashMap<String, String>>,
pub fail_on_http_status_codes: Option<Vec<u32>>,
pub fail_on_resource_http_status_codes: Option<Vec<u32>>,
pub fail_on_resource_loading_failed: Option<bool>,
pub fail_on_console_exceptions: Option<bool>,
}Expand description
Options for taking a screenshot of a webpage.
Fields§
§trace_id: Option<String>By default, the API assigns a unique UUID trace to every request. However, you also have the option to specify the trace for each request.
This trace will show up on the end server as a Gotenberg-Trace header.
width: Option<u32>The device screen width in pixels. Default: 800.
height: Option<u32>The device screen height in pixels. Default: 600.
clip: Option<bool>Define whether to clip the screenshot according to the device dimensions. Default: false.
format: Option<ImageFormat>The image format, either “png”, “jpeg” or “webp”. Default: png.
quality: Option<u8>The compression quality from range 0 to 100 (jpeg only). Default: 100.
omit_background: Option<bool>Hide the default white background and allow generating screenshots with transparency. Default: false.
optimize_for_speed: Option<bool>Define whether to optimize image encoding for speed, not for resulting size. Default: false.
wait_delay: Option<Duration>Duration to wait when loading an HTML document before converting it into PDF.
wait_for_expression: Option<String>The JavaScript expression to wait before converting an HTML document into PDF until it returns true.
For example:
# Somewhere in the HTML document.
var globalVar = 'notReady'
await promises()
window.globalVar = 'ready'request_options.wait_until = Some("window.globalVar === 'ready'".to_string());emulated_media_type: Option<MediaType>The media type to emulate, either “screen” or “print”. Default: “print”.
Cookies to store in the Chromium cookie jar
skip_network_idle_events: Option<bool>Do not wait for Chromium network to be idle. Default: true.
If you are having problems where the page is not fully rendered, try setting this to false.
user_agent: Option<String>Override the default User-Agent HTTP header.
extra_http_headers: Option<HashMap<String, String>>Extra HTTP headers to send by Chromium.
fail_on_http_status_codes: Option<Vec<u32>>Fail on these HTTP status codes.
Fail a response if the HTTP status code from the main page is not acceptable.
An X99 entry means every HTTP status codes between X00 and X99 (e.g., 499 means every HTTP status codes between 400 and 499).
Default: [499,599] (all 4XX and 5XX status codes)
fail_on_resource_http_status_codes: Option<Vec<u32>>Fail on these HTTP status codes on resources. Fail a response if any of the resources loaded in the page have a status code that is not acceptable. An X99 entry means every HTTP status codes between X00 and X99 (e.g., 499 means every HTTP status codes between 400 and 499). Default: None
fail_on_resource_loading_failed: Option<bool>Fail a response if Chromium fails to load at least one resource. Default: false.
fail_on_console_exceptions: Option<bool>Fail a response if there are exceptions in the Chromium console.
Trait Implementations§
Source§impl Clone for ScreenshotOptions
impl Clone for ScreenshotOptions
Source§fn clone(&self) -> ScreenshotOptions
fn clone(&self) -> ScreenshotOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more