Struct pdfium_render::pdfium::Pdfium
source · [−]pub struct Pdfium { /* private fields */ }Expand description
A high-level idiomatic Rust wrapper around Pdfium, the C++ PDF library used by the Google Chromium project.
Implementations
sourceimpl Pdfium
impl Pdfium
sourcepub fn bind_to_system_library(
) -> Result<Box<dyn PdfiumLibraryBindings>, PdfiumError>
pub fn bind_to_system_library(
) -> Result<Box<dyn PdfiumLibraryBindings>, PdfiumError>
Initializes the external Pdfium library, loading it from the system libraries. Returns a new PdfiumLibraryBindings object that contains bindings to the functions exposed by the library, or an error if the library could not be loaded.
sourcepub fn bind_to_library(
path: impl ToString
) -> Result<Box<dyn PdfiumLibraryBindings>, PdfiumError>
pub fn bind_to_library(
path: impl ToString
) -> Result<Box<dyn PdfiumLibraryBindings>, PdfiumError>
Initializes the external pdfium library, loading it from the given path. Returns a new PdfiumLibraryBindings object that contains bindings to the functions exposed by the library, or an error if the library could not be loaded.
sourcepub fn pdfium_platform_library_name() -> OsString
pub fn pdfium_platform_library_name() -> OsString
Returns the name of the external Pdfium library on the currently running platform. On Linux and Android, this will be libpdfium.so or similar; on Windows, this will be pdfium.dll or similar; on MacOS, this will be libpdfium.dylib or similar.
sourcepub fn pdfium_platform_library_name_at_path(path: impl ToString) -> String
pub fn pdfium_platform_library_name_at_path(path: impl ToString) -> String
Returns the name of the external Pdfium library on the currently running platform, prefixed with the given path string.
sourcepub fn new(bindings: Box<dyn PdfiumLibraryBindings>) -> Self
pub fn new(bindings: Box<dyn PdfiumLibraryBindings>) -> Self
Creates a new Pdfium object from the given external pdfium library bindings.
sourcepub fn load_pdf_from_file(
&self,
path: &str,
password: Option<&str>
) -> Result<PdfDocument<'_>, PdfiumError>
pub fn load_pdf_from_file(
&self,
path: &str,
password: Option<&str>
) -> Result<PdfDocument<'_>, PdfiumError>
Attempts to open a PdfDocument from the given file path.
If the document is password protected, the given password will be used to unlock it.
This function is not available when compiling to WASM. Either embed the bytes of
the target PDF document directly into the compiled WASM module using the
include_bytes!() macro, or use Javascript’s fetch() API to retrieve the bytes
of the target document over the network, then load those bytes into Pdfium using
the load_pdf_from_bytes() function.
sourcepub fn load_pdf_from_bytes(
&self,
bytes: &[u8],
password: Option<&str>
) -> Result<PdfDocument<'_>, PdfiumError>
pub fn load_pdf_from_bytes(
&self,
bytes: &[u8],
password: Option<&str>
) -> Result<PdfDocument<'_>, PdfiumError>
Attempts to open a PdfDocument from the given byte buffer.
If the document is password protected, the given password will be used to unlock it.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Pdfium
impl !Send for Pdfium
impl !Sync for Pdfium
impl Unpin for Pdfium
impl !UnwindSafe for Pdfium
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().