Skip to main content

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//! - [`fonts`] - Font management and embedding
40
41pub mod blocks;
42pub mod embed_pdf;
43pub mod fonts;
44pub mod hatching;
45pub mod images;
46pub mod ocg;
47
48pub use lopdf;
49
50// Common type aliases and utilities
51pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
52pub type Error = Box<dyn std::error::Error>;
53
54#[cfg(test)]
55mod tests {
56    // Tests are in separate integration test files
57}