pub struct CaptureOptions { /* private fields */ }Expand description
Configuration options for HTML screenshot capture.
Provides fine-grained control over the screenshot capture process, including image format, quality, viewport settings, and more.
§Example
use cdp_html_shot::{CaptureOptions, Viewport, ImageFormat};
let options = CaptureOptions::new()
.with_format(ImageFormat::Png)
.with_viewport(Viewport::new(1920, 1080).with_device_scale_factor(2.0))
.with_full_page(true);Implementations§
Source§impl CaptureOptions
impl CaptureOptions
Sourcepub fn with_format(self, format: ImageFormat) -> Self
pub fn with_format(self, format: ImageFormat) -> Self
Sets the image format for the screenshot.
Sourcepub fn with_quality(self, quality: u8) -> Self
pub fn with_quality(self, quality: u8) -> Self
Sets the quality for JPEG/WebP (0-100). Ignored for PNG.
Sourcepub fn with_viewport(self, viewport: Viewport) -> Self
pub fn with_viewport(self, viewport: Viewport) -> Self
Sets the viewport configuration for the capture.
This is particularly useful for setting deviceScaleFactor to get
higher resolution screenshots.
Sourcepub fn with_full_page(self, full_page: bool) -> Self
pub fn with_full_page(self, full_page: bool) -> Self
Sets whether to capture the full scrollable page.
Sourcepub fn with_omit_background(self, omit: bool) -> Self
pub fn with_omit_background(self, omit: bool) -> Self
Sets whether to omit the background (transparent for PNG).
Sourcepub fn with_clip(self, clip: ClipRegion) -> Self
pub fn with_clip(self, clip: ClipRegion) -> Self
Sets a clip region for the screenshot.
Sourcepub fn high_quality_jpeg() -> Self
pub fn high_quality_jpeg() -> Self
Convenience method: creates options for high-quality JPEG.
Sourcepub fn ultra_hidpi() -> Self
pub fn ultra_hidpi() -> Self
Convenience method: creates options for ultra HiDPI (3x) screenshots.
Sourcepub fn with_raw_png(self, raw: bool) -> Self
👎Deprecated since 0.2.0: Use with_format() instead
pub fn with_raw_png(self, raw: bool) -> Self
with_format() insteadSpecifies whether to capture screenshots as raw PNG (true) or JPEG (false).
Trait Implementations§
Source§impl Clone for CaptureOptions
impl Clone for CaptureOptions
Source§fn clone(&self) -> CaptureOptions
fn clone(&self) -> CaptureOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CaptureOptions
impl Debug for CaptureOptions
Source§impl Default for CaptureOptions
impl Default for CaptureOptions
Source§fn default() -> CaptureOptions
fn default() -> CaptureOptions
Auto Trait Implementations§
impl Freeze for CaptureOptions
impl RefUnwindSafe for CaptureOptions
impl Send for CaptureOptions
impl Sync for CaptureOptions
impl Unpin for CaptureOptions
impl UnwindSafe for CaptureOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more