pub enum Error {
Show 22 variants
FileNotFound {
path: PathBuf,
},
PasswordRequired {
path: PathBuf,
},
CorruptPdf {
path: Option<PathBuf>,
reason: String,
},
InvalidPageNumber {
requested: usize,
total: usize,
},
FontNotFound {
font_name: String,
},
PermissionDenied {
reason: String,
},
UnsupportedPdfVersion {
version: String,
},
FormFieldNotFound {
field_name: String,
},
SignatureVerificationFailed {
reason: String,
},
RedactionFailed {
reason: String,
},
ConversionFailed {
reason: String,
},
InvalidEncoding {
encoding: String,
},
StreamDecodeFailed {
filter: String,
},
XrefCorrupt {
reason: String,
},
LicenseExpired {
expired_since: String,
},
LicenseInvalid {
reason: String,
},
OutputWriteFailed {
path: PathBuf,
reason: String,
},
ImageDecodeFailed {
format: String,
},
EncryptionFailed {
reason: String,
},
ComplianceViolation {
standard: String,
reason: String,
},
Io(Error),
UnsupportedFeature {
feature: String,
},
}Expand description
Top-level error type for pdf-engine operations.
Each variant maps 1-to-1 to a stable PdfError::code string. Variants
carry the minimum fields needed to render a useful message and to give
the caller enough context to either retry or surface a clear message
to a human.
The std::fmt::Display implementation produces a multi-line, formatted
error message including a Help: block and a Docs: link. Use it as
format!("{err}") for human consumption; use PdfError::code for
programmatic dispatch.
Variants§
FileNotFound
The requested file could not be found at the given path. Returned before any parse work is attempted.
PasswordRequired
The PDF is encrypted and a password is required to open it. The
caller should retry with OpenOptions::with_password(...).
CorruptPdf
The PDF byte stream could not be parsed. The cross-reference table
is malformed, the trailer is unreachable, or a critical object is
missing. Try OpenOptions::repair(true) for a best-effort recovery.
Fields
InvalidPageNumber
The caller asked for a page index outside the document’s range. Page numbers are 1-based at the public API.
Fields
FontNotFound
A required font could not be located — neither embedded in the PDF, nor on the system, nor in the SDK’s Standard 14 fallback set.
PermissionDenied
The requested operation is not allowed by the document’s permission flags. The caller may need an owner password.
UnsupportedPdfVersion
The document declares a PDF version this build of the SDK does not understand.
FormFieldNotFound
A form-field operation referenced a field that does not exist in the document’s AcroForm dictionary.
Fields
SignatureVerificationFailed
A digital-signature verification step failed (chain of trust, hash mismatch, expired certificate, etc.).
RedactionFailed
A redaction operation could not complete. The document is guaranteed to be unchanged when this is returned (redaction is transactional — failure is total).
ConversionFailed
A format conversion (PDF → DOCX, PDF → image, HTML → PDF, etc.) failed before output was produced.
InvalidEncoding
A text or string encoding could not be decoded.
StreamDecodeFailed
A PDF stream could not be decoded — typically because the stream uses an unsupported filter or the encoded payload is corrupt.
XrefCorrupt
The cross-reference table is corrupt or unreadable. Try
OpenOptions::repair(true) for a best-effort recovery pass.
LicenseExpired
The PDFluent license file is past its expiry date. Renew the license or accept the unlicensed-evaluation behaviour.
LicenseInvalid
The license file is malformed, has a bad signature, or is for a different product/key set. The SDK falls back to evaluation mode when this fires unless the caller treats it as a hard error.
OutputWriteFailed
Writing the output document failed (disk full, permission denied, network drive vanished, etc.).
Fields
ImageDecodeFailed
An embedded image could not be decoded. Common causes: corrupt JPEG, unknown JPX profile, truncated pixel data.
EncryptionFailed
An encryption operation failed (wrong key, unsupported cipher, invalid permission flags).
ComplianceViolation
The document violates a declared compliance standard
(PDF/A, PDF/UA, PDF/X). Use pdf-compliance to repair if possible.
Fields
Io(Error)
A wrapped std::io::Error from a lower layer. Inspect the inner
error for the concrete cause.
UnsupportedFeature
The caller exercised a feature the SDK build does not include (typically a feature-gated capability that was not enabled at compile time).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
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