pub struct PdfiumConfig { /* private fields */ }Expand description
Configuration options for initializing the Pdfium library.
Implementations§
Source§impl PdfiumConfig
impl PdfiumConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new PdfiumConfig with default settings.
Sourcepub fn set_user_font_paths(self, paths: Vec<String>) -> Self
pub fn set_user_font_paths(self, paths: Vec<String>) -> Self
Sets the paths to scan for fonts in addition to the default system paths.
This is useful when you want to use custom fonts that are not installed on the system.
Sourcepub fn set_font_provider(self, fonts: Vec<FontDescriptor>) -> Self
pub fn set_font_provider(self, fonts: Vec<FontDescriptor>) -> Self
Sets a custom font provider with pre-loaded font data.
This bypasses all filesystem scanning and serves fonts directly from memory. Fonts are matched by family name, weight, italic style, and charset.
§Example
use pdfium_render::prelude::*;
use std::sync::Arc;
let fonts = vec![
FontDescriptor {
family: "Arial".to_string(),
weight: 400,
is_italic: false,
charset: 0,
data: Arc::from(std::fs::read("/fonts/Arial.ttf")?),
},
];
let config = PdfiumConfig::new()
.set_font_provider(fonts);Trait Implementations§
Source§impl Clone for PdfiumConfig
impl Clone for PdfiumConfig
Source§fn clone(&self) -> PdfiumConfig
fn clone(&self) -> PdfiumConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PdfiumConfig
impl Debug for PdfiumConfig
Source§impl Default for PdfiumConfig
impl Default for PdfiumConfig
Source§fn default() -> PdfiumConfig
fn default() -> PdfiumConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PdfiumConfig
impl RefUnwindSafe for PdfiumConfig
impl Send for PdfiumConfig
impl Sync for PdfiumConfig
impl Unpin for PdfiumConfig
impl UnsafeUnpin for PdfiumConfig
impl UnwindSafe for PdfiumConfig
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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