1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! # Rustybara
//!
//! Prepress-focused PDF manipulation library for graphic designers and print operators.
//!
//! Rustybara provides a high-level API for common prepress operations like trimming print marks,
//! resizing pages with bleed margins, rasterizing to images, and remapping CMYK colors. It speaks
//! in prepress vocabulary (TrimBox, BleedBox, DPI) rather than low-level PDF primitives.
//!
//! ## Core Operations
//!
//! - **Trim print marks** — Remove content outside TrimBox boundaries
//! - **Resize to bleed** — Expand MediaBox by specified bleed margins
//! - **Export to image** — Rasterize pages to JPEG, PNG, WebP, or TIFF
//! - **Remap CMYK colors** — Substitute specific CMYK values with tolerance matching
//! - **ICC color management** — Convert between color spaces using ICC profiles (via `color` feature)
//!
//! ## Quick Start
//!
//! ```no_run
//! use rustybara::PdfPipeline;
//!
//! # fn main() -> rustybara::Result<()> {
//! // Trim marks and resize to 9pt bleed
//! PdfPipeline::open("input.pdf")?
//! .trim()?
//! .resize(9.0)?
//! .save_pdf("output.pdf")?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Rasterization Example
//!
//! ```no_run
//! use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};
//!
//! # fn main() -> rustybara::Result<()> {
//! let pipeline = PdfPipeline::open("input.pdf")?;
//! let config = RenderConfig::prepress(); // 300 DPI
//!
//! pipeline.save_page_image(0, "page_1.jpg", &OutputFormat::Jpg, &config)?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Feature Flags
//!
//! - `color` — Enables ICC color management via the [`rustybara-icc`](https://github.com/Addy-A/rustybara/tree/main/rustybara-icc) crate
//! - `gpu` — Reserved for future GPU-accelerated rendering (not yet implemented)
//!
//! ## Architecture
//!
//! The library is organized around the [`PdfPipeline`] struct, which provides a chainable API
//! for PDF operations. Under the hood:
//!
//! - [`pages`] — Page box geometry and manipulation
//! - [`stream`] — Content stream filtering and color remapping
//! - [`raster`] — PDF rendering via PDFium
//! - [`encode`] — Image encoding to various formats
//! - [`geometry`] — 2D geometry primitives (Rect, Matrix)
//! - [`objects`] — Page object tree: painted shapes, images, and text runs
//! - `color` — ICC color management (feature-gated, requires `color` feature)
pub use Error;
pub use Result;
pub use DocumentColorKind;
pub use PdfPipeline;