How libharu/libharu works
Haru is a C library for generating PDF documents, with language bindings exposing its API. The principal workflow is a caller creating a document, adding pages and content, then writing a PDF. Major documented capabilities include text, images, fonts and encodings, annotations and outlines, compression, and encryption. The graph also shows the internal PDF-object and stream layer. Internal call paths are only partly evidenced by the supplied excerpts and source index, so documented feature links are identified as such rather than presented as verified call sequences.
Main entry points: hpdf.h C API · hpdf_doc.c Document lifecycle · hpdf.py Python binding · hpdf_pages.c Pages and drawing
Components 19
Public API
- C API
include/hpdf.h - Python binding
bindings/python/hpdf.py - Python types
bindings/python/hpdf_types.py - Python constants
bindings/python/hpdf_consts.py - Ruby binding
bindings/ruby/hpdf.c
Document Content
- Document lifecycle
src/hpdf_doc.c - Pages and drawing
src/hpdf_pages.c - Page operators
src/hpdf_page_operator.c - Annotations
src/hpdf_annotation.c
PDF Features
- Font definitions
src/hpdf_fontdef_base14.c - TrueType fonts
src/hpdf_fontdef_tt.c - Text encodings
src/hpdf_encoder.c - Japanese encodings
src/hpdf_encoder_jp.c - Images
src/hpdf_image.c - Encryption
src/hpdf_encrypt.c
PDF Internals
- PDF streams
src/hpdf_streams.c - PDF objects
src/hpdf_objects.c
Other components
- Library caller
- PDF file
Connections 19
- Library caller → C API: uses
- Library caller → Python binding: uses
- Library caller → Ruby binding: uses
- Python binding → Python constants: imports
bindings/python/hpdf.py - Python binding → Python types: imports
bindings/python/hpdf.py - Ruby binding → C API: calls
bindings/ruby/hpdf.c - C API → Document lifecycle: creates PDFs
src/hpdf_doc.c - Document lifecycle → PDF file: writes
- Document lifecycle → Pages and drawing: manages pages
- Pages and drawing → Page operators: draws content
src/hpdf_page_operator.c - Pages and drawing → Annotations: adds annotations
src/hpdf_pages.c - C API → Font definitions: embeds fonts
- C API → TrueType fonts: embeds TrueType
- C API → Text encodings: selects encodings
src/hpdf_encoder.c - Text encodings → Japanese encodings: supports CJK
- C API → Images: embeds images
- C API → Encryption: encrypts PDFs
- Document lifecycle → PDF objects: serializes objects
- PDF objects → PDF streams: writes streams