pdf_annot/error.rs
1//! Error types for annotation building.
2
3// Copyright (c) 2026 Innovation Trigger B.V.
4//
5// PDFluent is available under two licences, at your option: the GNU AGPLv3, or
6// the PDFluent Commercial Licence. See the LICENSE file in this repository --
7// that file travels with the copy you received, which a URL does not.
8
9/// Errors that can occur when building annotations.
10#[derive(Debug, thiserror::Error)]
11pub enum AnnotBuildError {
12 /// Page number is out of range.
13 #[error("page {0} out of range (document has {1} pages)")]
14 PageOutOfRange(u32, usize),
15
16 /// Failed to encode appearance stream content.
17 #[error("failed to encode appearance stream: {0}")]
18 AppearanceEncode(String),
19
20 /// The annotation rectangle is invalid (zero area).
21 #[error("invalid annotation rectangle: width or height is zero")]
22 InvalidRect,
23
24 /// Failed to write the annotation to the page dictionary (e.g. ObjStm page
25 /// that lopdf cannot mutate in-place). Fixes #470.
26 #[error("failed to write annotation to page dictionary")]
27 PageMutationFailed,
28}