micropdf 0.15.15

A pure Rust PDF library - A pure Rust PDF library with fz_/pdf_ API compatibility
//! QPDF-compatible features for MicroPDF
//!
//! This module provides functionality inspired by and compatible with QPDF,
//! the powerful PDF transformation library.
//!
//! ## Features
//!
//! - **Pipeline System**: Flexible stream processing with chainable filters
//! - **Content Stream Tokenizer**: Lexically-aware content stream parsing
//! - **JSON Support**: PDF to JSON roundtrip conversion
//! - **Linearization**: Reading and writing linearized PDFs
//! - **PDF Repair**: Automatic repair of malformed PDFs
//! - **Object Streams**: Full object stream compression support
//! - **Foreign Object Copying**: Copy objects between PDFs with dependency tracking
//! - **Document Helpers**: Enhanced AcroForm, Outline, and EmbeddedFile handling
//!
//! ## Example
//!
//! ```rust,ignore
//! use micropdf::qpdf::{Pipeline, PlBuffer, PlFlate, FlateAction};
//! use micropdf::qpdf::{Tokenizer, Token, TokenType};
//! use micropdf::qpdf::{is_linearized, quick_validate};
//! ```

pub mod annotation_helper;
pub mod buffer;
pub mod document;
pub mod embedded_file_helper;
pub mod error;
pub mod file_spec_helper;
pub mod form_helper;
pub mod job;
pub mod json;
pub mod linearization;
pub mod name_tree_helper;
pub mod number_tree_helper;
pub mod object_copy;
pub mod object_handle;
pub mod outline_helper;
pub mod page_doc_helper;
pub mod page_helper;
pub mod pipeline;
pub mod repair;
pub mod tokenizer;
pub mod writer;
pub mod xref_stream;

// ============================================================================
// Error types
// ============================================================================
pub use error::{QpdfError, Result};

// ============================================================================
// Pipeline system - chainable stream processing filters
// ============================================================================
pub use pipeline::{
    FlateAction,
    Pipeline,
    PipelineBox,
    // Encoding pipelines
    PlAscii85Decoder,
    PlAsciiHexDecoder,
    // Buffer pipelines
    PlBuffer,
    PlConcatenate,
    // Utility pipelines
    PlCount,
    PlDiscard,
    // Compression pipelines
    PlFlate,
    PlFunction,
    PlLzwDecoder,
    PlRunLengthDecoder,
    PlString,
};

// ============================================================================
// Buffer and memory management
// ============================================================================
pub use buffer::{Buffer, InputSource};

// ============================================================================
// Tokenizer - PDF content stream lexical analysis
// ============================================================================
pub use tokenizer::{Token, TokenType, Tokenizer};

// ============================================================================
// JSON support - QPDF-compatible JSON import/export
// ============================================================================
pub use json::{
    JsonDecodeLevel, JsonObject, JsonOutputConfig, JsonParameters, JsonPdf, JsonReference,
    JsonStream, JsonStreamData, JsonString,
};

// ============================================================================
// Linearization - web-optimized PDF support
// ============================================================================
pub use linearization::{
    // Data structures
    LinearizationCheckResult,
    LinearizationConfig,
    LinearizationParams,
    // Hint tables
    PageOffsetHintEntry,
    PageOffsetHintHeader,
    SharedObjectHintEntry,
    SharedObjectHintHeader,
    check_linearization,
    is_linearized,
    parse_page_offset_hints,
    parse_shared_object_hints,
    write_linearized,
};

// ============================================================================
// PDF Repair - fix corrupted PDFs
// ============================================================================
pub use repair::{
    RepairConfig, RepairIssue, RepairResult, quick_validate, rebuild_page_tree,
    remove_dangling_references, repair_pdf,
};

// ============================================================================
// Object copying - copy objects between PDFs
// ============================================================================
pub use object_copy::{CopyContext, ObjGen, ObjectMap, extract_references, rewrite_references};

// ============================================================================
// XRef streams - cross-reference table encoding/decoding
// ============================================================================
pub use xref_stream::{XRefEntry, XRefEntryType, XRefStreamDecoder, XRefStreamEncoder};

// ============================================================================
// Object handle - rich PDF object wrapper with serialization and manipulation
// ============================================================================
pub use object_handle::{ObjectHandle, PdfMatrix, Rectangle};

// ============================================================================
// Document model - full PDF document with object management
// ============================================================================
pub use document::{Document, EncryptionParams, Permissions};

// ============================================================================
// Job - declarative PDF transformation (QPDFJob equivalent)
// ============================================================================
pub use job::{EncryptionJobConfig, JobResult, PageLabelSpec, PageRange, PdfJob, parse_page_range};
pub use writer::ObjectStreamMode;

// ============================================================================
// Page helpers - page-level manipulation
// ============================================================================
pub use page_helper::{PageHelper, PageHelperMut};

// ============================================================================
// Page document helpers - document-level page operations
// ============================================================================
pub use page_doc_helper::{PageDocHelper, PageLabelStyle};

// ============================================================================
// Annotation helpers - annotation inspection and flattening
// ============================================================================
pub use annotation_helper::{AnnotationHelper, annotation_flags, flatten_annotations};

// ============================================================================
// Form helpers - AcroForm and form field handling
// ============================================================================
pub use form_helper::{AcroFormHelper, AcroFormHelperMut, ButtonType, FieldType, FormField};

// ============================================================================
// Outline helpers - PDF bookmarks/outlines (PDF spec 12.3.3)
// ============================================================================
pub use outline_helper::{
    OutlineDocHelper, OutlineHelper, build_outline_item, decode_outline_title,
};

// ============================================================================
// Embedded file helpers - PDF spec 7.11.4
// ============================================================================
pub use embedded_file_helper::{
    EmbeddedFileDocHelper, EmbeddedFileHelper, create_embedded_file_stream,
};

// ============================================================================
// File specification helpers - PDF spec 7.11.3
// ============================================================================
pub use file_spec_helper::{FileSpecHelper, create_file_spec};

/// QPDF module version
pub const VERSION: &str = env!("CARGO_PKG_VERSION");