/** * ┌─────────────────────────────────────────────────────────────────────────┐ * │ HEADER/FOOTER UTILITIES - PDF Header/Footer Functions │ * ├─────────────────────────────────────────────────────────────────────────┤ * │ Filename: header-footer-utils.ts │ * │ Language: TypeScript │ * │ MCP Server: PDF Operations Server │ * │ │ * │ Purpose: │ * │ Provides utility functions for adding headers and footers to PDF │ * │ files. Supports dynamic variables like page numbers, dates, and │ * │ titles. Optimized for large PDFs (300+ pages). │ * │ │ * │ Why this file exists: │ * │ - Centralizes header/footer logic for reuse across tools │ * │ - Implements memory-efficient processing for large PDFs │ * │ - Provides variable substitution and text rendering │ * │ - Handles page ranges and alignment options │ * │ │ * │ Features: │ * │ - Dynamic variables: {page}, {totalPages}, {date}, {title} │ * │ - Alignment options: left, center, right │ * │ - Text customization: font, size, color │ * │ - Page range support: apply to specific pages or all │ * │ - Memory optimization: batch processing for large files │ * │ │ * │ Security Considerations: │ * │ - Validates input and output paths │ * │ - Prevents path traversal attacks │ * │ - Handles memory limits gracefully │ * │ - Validates color ranges and page numbers │ * │ │ * │ Dependencies: │ * │ - pdf-lib: PDF creation and modification │ * │ - @pdf-lib/fontkit: Custom font support │ * │ - fs/promises: Async file operations │ * │ - path: Path manipulation │ * │ │ * │ Author: PDF MCP Team │ * │ Created: 2025-10-29 │ * │ Version: 1.0.0 │ * └─────────────────────────────────────────────────────────────────────────┘ */ import type { HeaderFooterConfig } from '../types.js'; /** * Adds headers and/or footers to all pages of a PDF document * Processes in batches for memory efficiency with large PDFs * * @param inputPath - Path to the input PDF file * @param config - Header/footer configuration * @param outputPath - Optional output path (defaults to input_with_headers_footers.pdf) * @returns Object containing output path and number of pages processed */ export declare function addHeaderFooterToPDF(inputPath: string, config: HeaderFooterConfig, outputPath?: string): Promise<{ outputPath: string; pagesProcessed: number; }>; /** * Batch processing fallback for extremely large PDFs (1000+ pages) * Uses the same approach with more aggressive memory management * * @param inputPath - Path to the input PDF file * @param config - Header/footer configuration * @param outputPath - Optional output path * @returns Object containing output path and number of pages processed */ export declare function addHeaderFooterToPDFBatched(inputPath: string, config: HeaderFooterConfig, outputPath?: string): Promise<{ outputPath: string; pagesProcessed: number; }>; //# sourceMappingURL=header-footer-utils.d.ts.map