Skip to main content

ManipError

Enum ManipError 

Source
pub enum ManipError {
Show 14 variants Pdf(Error), Io(Error), PageOutOfRange(usize, usize), EmptyPageRange, Encryption(String), DecryptionFailed, UnsupportedEncryption(String), InvalidBookmark(String), Watermark(String), Image(String), ImageTooLarge { width: u32, height: u32, bytes_per_pixel: u32, max_dimension: u32, max_allocation_bytes: usize, }, DecompressionLimitExceeded(u64), FontVariantNotEmbedded { current: String, requested: String, available_variants: Vec<String>, }, Other(String),
}
Expand description

Errors returned by the pdf-manip crate while performing page-level operations (merge, split, extract, rotate, watermark, encrypt, etc.).

These bubble up through the pdfluent facade as Error::* variants — customers will normally see them indirectly. Variants with explicit limit fields (image size, decompression cap) describe safety guards that refused to proceed; the source document is not modified.

Variants§

§

Pdf(Error)

The underlying PDF byte stream could not be parsed (malformed xref, truncated stream, unsupported construct). The wrapped lopdf::Error carries the detail.

§

Io(Error)

An I/O error while reading the source or writing the result.

§

PageOutOfRange(usize, usize)

A page index passed to a manipulation routine does not exist in the document. Fields: (requested_index, total_pages). Page indexes at this layer are 0-based; the public facade translates to 1-based.

§

EmptyPageRange

A range-based operation (extract, split) received an empty range. Returned eagerly to surface the no-op rather than silently produce an empty document.

§

Encryption(String)

Setting up an encryption pipeline failed (key derivation, cipher initialization, or invalid permission flag combination). The wrapped string identifies the failing step.

§

DecryptionFailed

Decryption failed. Either the supplied password is wrong, the document uses an algorithm this build does not support (RC4 in a no-RC4 build), or the encryption dictionary is malformed.

§

UnsupportedEncryption(String)

The document advertises an encryption algorithm that the SDK cannot read. The wrapped string identifies the algorithm (e.g. "V=4 RC4 with custom CFM").

§

InvalidBookmark(String)

A bookmark/outline operation received an invalid bookmark description (missing title, invalid destination, malformed tree).

§

Watermark(String)

A watermark operation could not be applied (font/image resolution failure, invalid coordinates, malformed text).

§

Image(String)

An image operation (insertion, replacement, watermark image) failed before the page was modified.

§

ImageTooLarge

An image operation refused to proceed because the requested image would exceed the configured allocation safety limits.

Allocation = width * height * bytes_per_pixel. The guards exist to prevent denial-of-service via crafted PDFs that trigger huge pixel-buffer allocations. If you genuinely need a larger image, raise the limit in the operation’s options or pre-resize the image before insertion.

Fields

§width: u32

Image width in pixels as decoded from the source.

§height: u32

Image height in pixels as decoded from the source.

§bytes_per_pixel: u32

Pixel-format depth (e.g. 4 for RGBA8) used to compute the allocation estimate.

§max_dimension: u32

The dimension cap (applied to both width and height) that the image violated.

§max_allocation_bytes: usize

The total-allocation cap in bytes that the image would have exceeded.

§

DecompressionLimitExceeded(u64)

A FlateDecode-compressed stream expanded past the configured decompression limit. Like ImageTooLarge this is a denial-of-service guard. The u64 is the byte limit that was hit.

§

FontVariantNotEmbedded

The requested bold or italic variant font is not embedded in the document.

set_text_run_style only swaps to fonts that are already present in the xref. Synthetic bold (stroke-and-fill) and system-font injection are explicitly forbidden. The caller must embed the variant before styling.

available_variants lists the BaseFont names of all variants of the same family that are embedded, so the caller can surface actionable guidance.

Fields

§current: String

BaseFont name of the current (pre-swap) font.

§requested: String

BaseFont name of the desired variant that was not found.

§available_variants: Vec<String>

All embedded font variants belonging to the same family.

§

Other(String)

A non-categorised manipulation failure. Reserved for cases the more specific variants do not cover; the message describes the situation.

Trait Implementations§

Source§

impl Debug for ManipError

Source§

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

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

impl Display for ManipError

Source§

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

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

impl Error for ManipError

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 ManipError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ManipError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ManipError> for TextEditError

Source§

fn from(source: ManipError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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, 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.