Skip to main content

fop_pdf_renderer/
error.rs

1//! Error types for fop-pdf-renderer
2
3use thiserror::Error;
4
5/// Errors that can occur during PDF rendering
6#[derive(Debug, Error)]
7pub enum PdfRenderError {
8    /// PDF structure parsing error
9    #[error("PDF parse error: {0}")]
10    Parse(String),
11
12    /// Unsupported PDF feature
13    #[error("Unsupported PDF feature: {0}")]
14    Unsupported(String),
15
16    /// Page index out of bounds
17    #[error("Page {0} not found (document has {1} pages)")]
18    PageNotFound(usize, usize),
19
20    /// Font error
21    #[error("Font error: {0}")]
22    Font(String),
23
24    /// Image decoding error
25    #[error("Image error: {0}")]
26    Image(String),
27
28    /// IO error
29    #[error("IO error: {0}")]
30    Io(#[from] std::io::Error),
31
32    /// Decompression error
33    #[error("Decompression error: {0}")]
34    Decompress(String),
35}
36
37/// Result type for PDF rendering operations
38pub type Result<T> = std::result::Result<T, PdfRenderError>;