pub struct Html2PdfConverter { /* private fields */ }
Expand description
Main converter for HTML to PDF with password protection.
Implementations§
Source§impl Html2PdfConverter
impl Html2PdfConverter
Sourcepub async fn with_options(launch_options: LaunchOptions<'_>) -> Result<Self>
pub async fn with_options(launch_options: LaunchOptions<'_>) -> Result<Self>
Create a new converter with custom browser launch options.
Sourcepub async fn convert_html_to_pdf(
&self,
html: &str,
options: PdfOptions,
) -> Result<Vec<u8>>
pub async fn convert_html_to_pdf( &self, html: &str, options: PdfOptions, ) -> Result<Vec<u8>>
Convert HTML string to PDF bytes.
Sourcepub async fn convert_html_file_to_pdf(
&self,
file_path: &str,
options: PdfOptions,
) -> Result<Vec<u8>>
pub async fn convert_html_file_to_pdf( &self, file_path: &str, options: PdfOptions, ) -> Result<Vec<u8>>
Convert HTML file to PDF bytes.
Sourcepub async fn convert_url_to_pdf(
&self,
url: &str,
options: PdfOptions,
) -> Result<Vec<u8>>
pub async fn convert_url_to_pdf( &self, url: &str, options: PdfOptions, ) -> Result<Vec<u8>>
Convert URL to PDF bytes.
Sourcepub async fn convert_html_to_protected_pdf(
&self,
html: &str,
pdf_options: PdfOptions,
password_options: PasswordOptions,
) -> Result<Vec<u8>>
pub async fn convert_html_to_protected_pdf( &self, html: &str, pdf_options: PdfOptions, password_options: PasswordOptions, ) -> Result<Vec<u8>>
Convert HTML to password-protected PDF.
This method attempts to use qpdf for proper encryption. If qpdf is not available,
it will return an unencrypted PDF with warnings. For guaranteed encryption,
use convert_html_to_protected_pdf_with_qpdf
and handle the error appropriately.
Sourcepub async fn convert_html_file_to_protected_pdf(
&self,
file_path: &str,
pdf_options: PdfOptions,
password_options: PasswordOptions,
) -> Result<Vec<u8>>
pub async fn convert_html_file_to_protected_pdf( &self, file_path: &str, pdf_options: PdfOptions, password_options: PasswordOptions, ) -> Result<Vec<u8>>
Convert HTML file to password-protected PDF.
Sourcepub async fn convert_url_to_protected_pdf(
&self,
url: &str,
pdf_options: PdfOptions,
password_options: PasswordOptions,
) -> Result<Vec<u8>>
pub async fn convert_url_to_protected_pdf( &self, url: &str, pdf_options: PdfOptions, password_options: PasswordOptions, ) -> Result<Vec<u8>>
Convert URL to password-protected PDF.
Sourcepub async fn convert_html_to_protected_pdf_with_qpdf(
&self,
html: &str,
pdf_options: PdfOptions,
password_options: PasswordOptions,
temp_dir: Option<&str>,
) -> Result<Vec<u8>>
pub async fn convert_html_to_protected_pdf_with_qpdf( &self, html: &str, pdf_options: PdfOptions, password_options: PasswordOptions, temp_dir: Option<&str>, ) -> Result<Vec<u8>>
Convert HTML to password-protected PDF using qpdf (if available). This provides stronger encryption than the basic implementation.
Sourcepub async fn convert_html_file_to_protected_pdf_with_qpdf(
&self,
file_path: &str,
pdf_options: PdfOptions,
password_options: PasswordOptions,
temp_dir: Option<&str>,
) -> Result<Vec<u8>>
pub async fn convert_html_file_to_protected_pdf_with_qpdf( &self, file_path: &str, pdf_options: PdfOptions, password_options: PasswordOptions, temp_dir: Option<&str>, ) -> Result<Vec<u8>>
Convert HTML file to password-protected PDF using qpdf (if available).
Sourcepub async fn convert_url_to_protected_pdf_with_qpdf(
&self,
url: &str,
pdf_options: PdfOptions,
password_options: PasswordOptions,
temp_dir: Option<&str>,
) -> Result<Vec<u8>>
pub async fn convert_url_to_protected_pdf_with_qpdf( &self, url: &str, pdf_options: PdfOptions, password_options: PasswordOptions, temp_dir: Option<&str>, ) -> Result<Vec<u8>>
Convert URL to password-protected PDF using qpdf (if available).
Auto Trait Implementations§
impl Freeze for Html2PdfConverter
impl !RefUnwindSafe for Html2PdfConverter
impl Send for Html2PdfConverter
impl Sync for Html2PdfConverter
impl Unpin for Html2PdfConverter
impl !UnwindSafe for Html2PdfConverter
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> 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