encrypt_pdf_with_qpdf

Function encrypt_pdf_with_qpdf 

Source
pub fn encrypt_pdf_with_qpdf(
    pdf_data: Vec<u8>,
    password_options: &PasswordOptions,
    temp_dir: Option<&str>,
) -> Result<Vec<u8>>
Expand description

Apply password protection using external qpdf tool (if available). This is a more robust solution for production use.

§Prerequisites

  • qpdf must be installed on the system
  • Sufficient disk space for temporary files

§Arguments

  • pdf_data: The PDF data to encrypt
  • password_options: Password and encryption settings
  • temp_dir: Optional temporary directory (defaults to /tmp)

§Returns

  • Ok(Vec<u8>): Encrypted PDF data
  • Err(Html2PdfError): If qpdf is not available or encryption fails