DOCUMENTATION & SPECIFICATION
komopdf Feature Guide
This guide covers features currently implemented and active in the komopdf engine. All operations follow an atomic transaction model with full undo/redo support.
Text Editing & Font System
komopdf modifies text at the PDF stream operator level rather than drawing HTML overlays:
- In-Place Replacement: Select existing text blocks or characters to replace their string content while maintaining grapheme cluster boundaries and baseline alignment.
- Multi-Line Insertion: Insert paragraphs with automatic text wrapping, custom line height multipliers, paragraph margins, and alignment (left, center, right). Empty lines do not generate phantom PDF objects.
- Typography & Styles: Adjust font size, fill color, character spacing, and true font weights. Italic slant and bounding box extents are calculated from raw font glyph metrics.
- Bundled Fonts (6 families, 18 faces): Noto Sans CJK SC (Regular/Bold), Noto Serif CJK SC (Regular/Bold), LXGW WenKai (Regular/Medium), Liberation Sans (4 styles), Liberation Serif (4 styles), and Liberation Mono (4 styles).
- Custom Font Import: Load external TTF or OpenType/CFF files, select individual faces from TrueType Collection (.ttc) files, or query authorized browser system fonts.
Page Operations & Assembly
Manipulate individual pages or merge multi-document content seamlessly:
- Rotation: Rotate selected pages by 90°, 180°, or 270°. Existing page annotations and form fields adapt accordingly.
- Page Reordering: Drag and drop page thumbnails to reorder document sequences in a single atomic transaction.
- Page Insertion & Duplication: Insert blank pages at any position or clone existing pages along with their vector resources.
- Import from External PDF: Import specific page ranges from an external PDF file into the active document. Imported pages are incorporated as native page dictionaries without rasterization.
- Page Deletion: Remove unneeded pages with immediate undo availability. Documents must retain at least one page.
Objects, Vectors & Images
Object-level operations operate through stable object identifiers and affine transformations:
- Image Insertion: Embed PNG and JPEG images with preservation of full alpha transparency and resolution.
- Shared Instance Isolation: Replacing an image that appears multiple times in a document automatically isolates the modified instance so other pages remain untouched.
- Reversible Crop: Crop raster images non-destructively by adjusting clipping paths. Original image byte streams are preserved in the transaction history.
- Object Transformation: Move, scale, rotate, and align text and graphical objects on the canvas using direct mouse handles or numerical inputs.
Document Protection & QPDF Optimization
Security operations are driven by QPDF 12.4.1 compiled to WebAssembly (browser) and native binaries (desktop):
- AES-256 Encryption: Apply standard 256-bit AES encryption with user and owner passwords. Specify permissions for printing, copying, and modification.
- Password Protected Opening: Open encrypted PDFs with user or owner credentials. If a password fails, retry without corrupting previously loaded workspace state.
- Lossless Linearization: Optimize PDF object streams, cross-reference tables, and unreferenced object garbage collection without lossy image re-compression.
- Zero Cloud Leakage: Passwords and encryption keys are processed strictly in memory within the local browser tab or native process.
AI Agent komo & Candidate Verification
The built-in assistant komo operates under strict verification protocols:
- Candidate Generation: komo never writes directly to your PDF file. AI suggestions are rendered as previewable diff candidates.
- Explicit Acceptance: You review the proposed changes before committing them into the transaction log. A discarded suggestion leaves zero artifacts.
- Scoped Payloads: Only the specific text snippet, prompt instruction, or bounding box necessary to fulfill your request is transmitted to the gateway.
- Rate & Budget Limits: The gateway enforces strict token and request limits to ensure service stability without tracking user identities.
Transaction History & Shortcuts
komopdf maintains an immutable command journal enabling reliable state recovery:
- Undo / Redo: Ctrl+Z / Cmd+Z to undo; Ctrl+Y / Cmd+Shift+Z to redo.
- Grapheme Navigation: Arrow keys and Shift selections navigate by Unicode grapheme clusters, preventing corrupted surrogate pairs.
- Save Safeguards: Navigating away from a modified document prompts a confirmation modal to avoid accidental data loss.