Releases: Manuel1471/paper_forge
Release list
PaperForge 0.3.0 — Embedded Fonts, Unicode Text, and Document Layout
PaperForge 0.3.0 expands the pure Elixir PDF engine with embedded TrueType fonts, visible Unicode text, font families, default fonts, real TrueType text metrics, vertical flow, automatic page breaks, basic tables, and URI link annotations.
Highlights:
- Embedded TrueType fonts with Type0 / CIDFontType2 PDF font objects
- Identity-H encoding and
/ToUnicodemaps for Unicode extraction/search - Font-family registration with regular, bold, italic, and bold italic variants
- Document-level default font selection
- TrueType-backed text measurement, wrapping, and alignment
- Logical subsetting of PDF
/Warrays and/ToUnicodemaps to used glyphs - Vertical text flow with automatic page breaks
- Basic table rendering
- Link annotations with URI actions
- PNG RGBA transparency via
/SMask - Complete showcase example and expanded test coverage
Note: physical TTF table subsetting is not included yet; /FontFile2 still embeds the full .ttf program.
PaperForge v0.2.0
PaperForge v0.2.0
PaperForge v0.2.0 is a major expansion of the pure Elixir PDF generation engine.
This release adds richer text layout, compressed streams, configurable PDF versions, multiple standard fonts, margins, coordinate systems, JPEG and PNG images, transparency, resource deduplication, and stronger PDF integrity testing.
Highlights
Text and fonts
- Support for all 14 standard PDF Type 1 fonts
- Automatic font registration and reuse
- Text-width measurement
- Left, center, and right alignment
- Automatic word wrapping
- Explicit line breaks
- Configurable line height
- Multiline text boxes
- Text-box overflow information
Pages and layout
- Top-left and bottom-left coordinate systems
- Uniform and per-side margins
- Content-boundary helpers
- Portrait and landscape orientations
- Configurable PDF versions
Images
- JPEG support:
- Grayscale
- RGB
- CMYK
- PNG support:
- Grayscale
- RGB
- Grayscale with alpha
- RGBA
- PNG transparency through PDF soft masks
- Automatic aspect-ratio preservation
- Image loading from file paths or binaries
- SHA-256 image deduplication
- Reuse of image and
/SMaskresources - Optimized PNG handling for large images
PDF internals
- Flate-compressed page streams
- Optional uncompressed output
- Centralized page compilation
- Centralized page resource management
- Unicode metadata through UTF-16BE
- Cross-reference offset validation
- Structural end-to-end PDF tests
Validation
- 94 tests passing
- Compilation passes with
--warnings-as-errors - Documentation builds successfully
- Hex package builds successfully
Current limitation
Visible text still uses standard PDF font encodings. Embedded TrueType fonts and full Unicode visible text are planned for v0.3.0.
PaperForge v0.1.0 — Initial PDF Core and Graphics
PaperForge v0.1.0 — Initial PDF Core and Graphics
PaperForge v0.1.0 is the first public release of the project.
This version introduces the initial pure Elixir PDF generation engine, capable of building valid multi-page PDF documents directly without browsers, external binaries, or rendering services.
Highlights
- Pure Elixir PDF generation
- Multi-page document support
- PDF object graph with indirect objects and references
- PDF primitive serialization
- Streams with automatic byte-length calculation
- Traditional cross-reference table generation
- PDF trailer and
startxrefgeneration - Built-in Helvetica text
- Text positioning, font size, and color
- Lines with configurable width and color
- Rectangles with fill and stroke support
- Circles rendered with cubic Bézier curves
- RGB and grayscale colors
- A3, A4, A5, Letter, Legal, and custom page sizes
- Portrait and landscape orientations
- Basic PDF metadata
- Binary and file output APIs
- Automated tests and GitHub Actions CI
Example
alias PaperForge.Color
alias PaperForge.Page
document =
PaperForge.new()
|> PaperForge.metadata(
title: "PaperForge Example",
author: "Manuel Garcia"
)
|> PaperForge.add_page(fn page ->
page
|> Page.text(
"Hello from PaperForge",
x: 72,
y: 760,
size: 28,
color: Color.rgb255(35, 60, 120)
)
|> Page.rectangle(
x: 72,
y: 580,
width: 220,
height: 110,
fill: true,
stroke: true,
fill_color: Color.rgb255(235, 240, 250),
stroke_color: Color.rgb255(35, 60, 120)
)
end)
PaperForge.write!(document, "example.pdf")Included in this release
PDF core
- Serialization of PDF primitive values
- Indirect object representation
- Object references such as
3 0 R - Stream objects with automatic
/Length - Document catalog generation
- Page tree generation
- Cross-reference table generation
- Trailer and EOF generation
- Binary PDF output
Pages
- Multiple pages
- A3
- A4
- A5
- Letter
- Legal
- Custom page dimensions
- Portrait orientation
- Landscape orientation
Graphics
- Text
- Lines
- Rectangles
- Circles
- Fill colors
- Stroke colors
- Configurable line width
- RGB colors
- RGB 0–255 helper
- Grayscale colors
Metadata
- Title
- Author
- Subject
- Keywords
- Creator
- Producer
Current limitations
This is an early release and the public API may change before 1.0.0.
The following features are not yet included:
- Text measurement and alignment
- Automatic line wrapping
- Embedded TrueType or OpenType fonts
- Full Unicode support
- Images
- Stream compression
- Paragraph layout
- Automatic page breaks
- Tables
- HTML and CSS rendering
- Existing PDF parsing or editing
Technical notes
PaperForge currently:
- Uses traditional cross-reference tables
- Uses generation
0for newly created indirect objects - Uses the native PDF coordinate system
- Uses the bottom-left corner as the page origin
- Uses
iodatainternally to reduce unnecessary binary concatenation - Isolates drawing operations with the PDF
qandQgraphics-state operators - Uses Helvetica with WinAnsiEncoding as the default font
- Approximates circles using four cubic Bézier curves
Next steps
Planned improvements for future releases include:
- Text measurement
- Horizontal text alignment
- Automatic line wrapping
- Additional built-in PDF fonts
- JPEG image support
- Stream compression with
FlateDecode - Top-left coordinate helpers
- Page margins
- Paragraph layout
- Automatic page breaks
PaperForge is still experimental, but v0.1.0 establishes the foundational PDF object, graphics, serialization, and writing layers for future development.