1use crate::Rect;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct Diagnostic {
9 pub code: String,
10 pub page_index: usize,
11 pub message: String,
12}
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct Character {
17 pub index: usize,
18 pub unicode: u32,
19 pub is_generated: bool,
20 pub text: Option<String>,
21 pub font_name: String,
22 pub font_size_pt: f64,
23 pub angle_degrees: f64,
24 pub origin: [f64; 2],
25 pub tight_bounds: Rect,
26 pub loose_bounds: Rect,
27 pub visual_tight_bounds: Rect,
28 pub visual_loose_bounds: Rect,
29 pub visual_origin: [f64; 2],
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct Page {
35 pub page_index: usize,
36 pub width_pt: f64,
37 pub height_pt: f64,
38 pub text: String,
39 pub object_count: usize,
40 pub characters: Vec<Character>,
41 pub page_bounds: Rect,
42 pub rotation: u16,
43 pub visual_width_pt: f64,
44 pub visual_height_pt: f64,
45 pub paths: Vec<VectorPath>,
46 pub images: Vec<ImageFact>,
47 pub links: Vec<LinkFact>,
48 pub form_count: usize,
49 pub drawing_lines: Vec<DrawingLine>,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54pub struct DrawingLine {
55 pub start: [f64; 2],
56 pub end: [f64; 2],
57 pub bounds: Rect,
58 pub width: f64,
59 pub orientation: String,
60}
61
62#[derive(Debug, Clone, Serialize, Deserialize)]
64pub struct PathSegment {
65 pub kind: String,
66 pub point: [f64; 2],
67 pub local_point: [f64; 2],
68 pub close: bool,
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
73pub struct VectorPath {
74 pub object_path: Vec<usize>,
75 pub bounds: Rect,
76 pub visual_bounds: Rect,
77 pub evidence_bounds: Option<Rect>,
78 pub clip_bounds: Option<Rect>,
79 pub matrix: [f64; 6],
80 pub segments: Vec<PathSegment>,
81 pub fill_rule: String,
82 pub fill_rgba: [u8; 4],
83 pub stroke: bool,
84 pub stroke_rgba: [u8; 4],
85 pub stroke_width_local: f64,
86 pub fill_visible: bool,
87 pub stroke_visible: bool,
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92pub struct ImageFact {
93 pub object_path: Vec<usize>,
94 pub bounds: Rect,
95 pub visual_bounds: Rect,
96 pub clip_bounds: Option<Rect>,
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101pub struct LinkFact {
102 pub index: usize,
103 pub bounds: Rect,
104 pub visual_bounds: Rect,
105 pub uri: Option<String>,
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110pub struct Document {
111 pub schema_version: u32,
112 pub coordinate_system: String,
113 pub source_page_count: usize,
114 pub pages: Vec<Page>,
115 pub diagnostics: Vec<Diagnostic>,
116}