hipdf/
lib.rs

1//! # hipdf
2//!
3//! A high-level PDF manipulation library built on lopdf, focusing on ease of use
4//! and powerful abstractions for common PDF operations.
5//!
6//! ## Features
7//!
8//! - **OCG (Optional Content Groups) Support**: Easy creation and management of PDF layers
9//! - **Layer Management**: High-level API for organizing content into toggleable layers
10//! - **Content Building**: Fluent API for building layered PDF content
11//! - **Type Safety**: Strongly typed interfaces with compile-time guarantees
12//! - **WASM Support**: Automatic configuration for WebAssembly targets
13//!
14//! ## Example
15//!
16//! ```rust
17//! use hipdf::ocg::{OCGManager, Layer, LayerContentBuilder, LayerOperations as Ops};
18//! use lopdf::{Document, Object};
19//!
20//! // Create a new PDF with layers
21//! let mut doc = Document::with_version("1.5");
22//! let mut ocg_manager = OCGManager::with_config(Default::default());
23//!
24//! // Add layers
25//! ocg_manager.add_layer(Layer::new("Background", true));
26//! ocg_manager.add_layer(Layer::new("Main Content", true));
27//!
28//! // Initialize layers in document
29//! ocg_manager.initialize(&mut doc);
30//! ```
31//!
32//! ## Modules
33//!
34//! - [`ocg`] - Optional Content Groups (layers) functionality
35//! - [`hatching`] - Hatching and pattern support for PDF documents
36//! - [`embed_pdf`] - Embedding existing PDF documents
37//! - [`blocks`] - Block content management
38//! - [`images`] - Image embedding and manipulation
39
40pub mod embed_pdf;
41pub mod hatching;
42pub mod ocg;
43pub mod blocks;
44pub mod images;
45
46pub use lopdf;
47
48// Common type aliases and utilities
49pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
50pub type Error = Box<dyn std::error::Error>;
51
52#[cfg(test)]
53mod tests {
54    // Tests are in separate integration test files
55}