pub enum RedactError {
Pdf(Error),
Io(Error),
PageOutOfRange(u32, u32),
NoAreas,
UnsupportedImageFilter(String),
UnsupportedToUnicodeCMap {
font_resource_name: String,
reason: String,
},
Other(String),
}Expand description
Errors returned by the pdf-redact crate while marking or applying
content redaction.
Redaction is high-stakes (compliance, legal disclosure) so each variant describes a refusal to proceed rather than a best-effort fallback. If you receive any variant, the input is left untouched.
Variants§
Pdf(Error)
The underlying PDF byte stream could not be parsed.
Typically a malformed cross-reference table, a truncated stream, or an encrypted PDF that was not opened with the right password.
Io(Error)
An I/O error occurred while reading the source PDF or writing the redacted output.
PageOutOfRange(u32, u32)
The caller asked to redact a page index that does not exist in the document.
Fields: (requested_page, total_pages). Page numbers are 1-based.
NoAreas
The redaction call had no regions and no search query — nothing to remove. Returned eagerly so callers do not silently produce no-op output.
UnsupportedImageFilter(String)
An image embedded inside a redaction region uses a PDF stream filter that the redactor cannot rewrite (for example JBIG2 or some JPEG2000 profiles). The redaction is aborted because partially-stripped images would leak content. The caller can either rasterise the page before redacting or skip the affected page.
UnsupportedToUnicodeCMap
A page touched by the redaction has a /ToUnicode CMap whose shape
the conservative pdf-redact parser cannot rewrite safely.
The redactor refuses to silently drop the CMap because that would break text-extraction tools downstream. The caller’s options are to rasterise the page first or to redact a different page range that does not include this font.
Fields
Other(String)
A non-categorised redaction failure. Reserved for cases the more specific variants do not cover; the message describes the situation.
Trait Implementations§
Source§impl Debug for RedactError
impl Debug for RedactError
Source§impl Display for RedactError
impl Display for RedactError
Source§impl Error for RedactError
impl Error for RedactError
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()
Source§impl From<Error> for RedactError
impl From<Error> for RedactError
Auto Trait Implementations§
impl Freeze for RedactError
impl !RefUnwindSafe for RedactError
impl Send for RedactError
impl Sync for RedactError
impl Unpin for RedactError
impl UnsafeUnpin for RedactError
impl !UnwindSafe for RedactError
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