Skip to main content

Error

Enum Error 

Source
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.

Fields

§path: PathBuf

The path that was requested but does not exist.

§

PasswordRequired

The PDF is encrypted and a password is required to open it. The caller should retry with OpenOptions::with_password(...).

Fields

§path: PathBuf

The path of the encrypted document.

§

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

§path: Option<PathBuf>

Path to the source file, when known.

§reason: String

Human-readable diagnostic of what went wrong (for example “missing trailer”, “bad startxref offset”).

§

InvalidPageNumber

The caller asked for a page index outside the document’s range. Page numbers are 1-based at the public API.

Fields

§requested: usize

The page index the caller requested.

§total: usize

How many pages the document actually has.

§

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.

Fields

§font_name: String

The PDF base font name that could not be resolved.

§

PermissionDenied

The requested operation is not allowed by the document’s permission flags. The caller may need an owner password.

Fields

§reason: String

Which operation was denied (for example “modify”, “print”).

§

UnsupportedPdfVersion

The document declares a PDF version this build of the SDK does not understand.

Fields

§version: String

The version string from the document header (e.g. "2.1").

§

FormFieldNotFound

A form-field operation referenced a field that does not exist in the document’s AcroForm dictionary.

Fields

§field_name: String

The field name the caller asked for. List actual field names with doc.form_fields().

§

SignatureVerificationFailed

A digital-signature verification step failed (chain of trust, hash mismatch, expired certificate, etc.).

Fields

§reason: String

Specific failure reason from the signing pipeline.

§

RedactionFailed

A redaction operation could not complete. The document is guaranteed to be unchanged when this is returned (redaction is transactional — failure is total).

Fields

§reason: String

Diagnostic of what blocked the redaction.

§

ConversionFailed

A format conversion (PDF → DOCX, PDF → image, HTML → PDF, etc.) failed before output was produced.

Fields

§reason: String

Diagnostic of what blocked the conversion.

§

InvalidEncoding

A text or string encoding could not be decoded.

Fields

§encoding: String

The encoding name that failed (for example "WinAnsiEncoding").

§

StreamDecodeFailed

A PDF stream could not be decoded — typically because the stream uses an unsupported filter or the encoded payload is corrupt.

Fields

§filter: String

The PDF filter name from the stream’s /Filter entry.

§

XrefCorrupt

The cross-reference table is corrupt or unreadable. Try OpenOptions::repair(true) for a best-effort recovery pass.

Fields

§reason: String

Diagnostic of why the xref could not be parsed.

§

LicenseExpired

The PDFluent license file is past its expiry date. Renew the license or accept the unlicensed-evaluation behaviour.

Fields

§expired_since: String

The expiry date the license declared, as an ISO-8601 string.

§

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.

Fields

§reason: String

Specific reason the license could not be accepted.

§

OutputWriteFailed

Writing the output document failed (disk full, permission denied, network drive vanished, etc.).

Fields

§path: PathBuf

The destination path that was being written.

§reason: String

Underlying I/O reason from the OS.

§

ImageDecodeFailed

An embedded image could not be decoded. Common causes: corrupt JPEG, unknown JPX profile, truncated pixel data.

Fields

§format: String

The image format name (for example "JPEG", "JPX").

§

EncryptionFailed

An encryption operation failed (wrong key, unsupported cipher, invalid permission flags).

Fields

§reason: String

Diagnostic of what blocked encryption.

§

ComplianceViolation

The document violates a declared compliance standard (PDF/A, PDF/UA, PDF/X). Use pdf-compliance to repair if possible.

Fields

§standard: String

The compliance standard the document failed against (e.g. "PDF/A-2b").

§reason: String

The specific violation that triggered the failure.

§

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).

Fields

§feature: String

The feature name (matching the Cargo feature flag where applicable).

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl PdfError for Error

Source§

fn code(&self) -> &str

Stable machine-readable identifier for the error. Read more
Source§

fn help(&self) -> Option<String>

Human-readable, actionable help text. Read more
Source§

fn docs_url(&self) -> String

Deep link to the canonical documentation page for this error. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,