Skip to main content

pdf_annot/
error.rs

1//! Error types for annotation building.
2
3/// Errors that can occur when building annotations.
4#[derive(Debug, thiserror::Error)]
5pub enum AnnotBuildError {
6    /// Page number is out of range.
7    #[error("page {0} out of range (document has {1} pages)")]
8    PageOutOfRange(u32, usize),
9
10    /// Failed to encode appearance stream content.
11    #[error("failed to encode appearance stream: {0}")]
12    AppearanceEncode(String),
13
14    /// The annotation rectangle is invalid (zero area).
15    #[error("invalid annotation rectangle: width or height is zero")]
16    InvalidRect,
17
18    /// Failed to write the annotation to the page dictionary (e.g. ObjStm page
19    /// that lopdf cannot mutate in-place).  Fixes #470.
20    #[error("failed to write annotation to page dictionary")]
21    PageMutationFailed,
22}