Crate hipdf

Crate hipdf 

Source
Expand description

§hipdf

A high-level PDF manipulation library built on lopdf, focusing on ease of use and powerful abstractions for common PDF operations.

§Features

  • OCG (Optional Content Groups) Support: Easy creation and management of PDF layers
  • Layer Management: High-level API for organizing content into toggleable layers
  • Content Building: Fluent API for building layered PDF content
  • Type Safety: Strongly typed interfaces with compile-time guarantees
  • WASM Support: Automatic configuration for WebAssembly targets

§Example

use hipdf::ocg::{OCGManager, Layer, LayerContentBuilder, LayerOperations as Ops};
use lopdf::{Document, Object};

// Create a new PDF with layers
let mut doc = Document::with_version("1.5");
let mut ocg_manager = OCGManager::with_config(Default::default());

// Add layers
ocg_manager.add_layer(Layer::new("Background", true));
ocg_manager.add_layer(Layer::new("Main Content", true));

// Initialize layers in document
ocg_manager.initialize(&mut doc);

§Modules

  • ocg - Optional Content Groups (layers) functionality
  • hatching - Hatching and pattern support for PDF documents
  • embed_pdf - Embedding existing PDF documents
  • blocks - Block content management
  • images - Image embedding and manipulation
  • fonts - Font management and embedding

Re-exports§

pub use lopdf;

Modules§

blocks
Block System for PDF - Reusable Content Components
embed_pdf
PDF embedding and composition support
fonts
Font handling module for PDF documents with standard and custom font support
hatching
Hatching and pattern support for PDF documents
images
Enhanced Image handling module for PDF documents with 100% quality preservation
ocg
Optional Content Groups (OCG) / Layers support for PDF documents

Macros§

block
Convenience macro for creating blocks
instance
Convenience macro for creating instances
layer
Convenience macro for creating layers
layer_content
Convenience macro for building layer content

Type Aliases§

Error
Result