Built-in Vector Engine Rust 2021 Backend

High-Performance Vector PDF Generation & Universal Compatibility

Stamp Album Generator 2 features a standalone, built-in native PDF generator written in Rust. It eliminates all reliance on external command-line utilities, subprocess calls, or intermediate software while producing publication-grade vector PDF album pages directly.

The engine provides dual unified input paths: the canonical, human-readable .stampalbum document format with sub-millimeter layout controls, alongside a built-in bounded interpreter that flawlessly executes legacy AlbumEasy .txt scripts.

📚 43 Verified Command Families 📄 300 Live Output PDFs ⚡ 31 Canonical Native Commands 🔄 43 Mapped AlbumEasy Commands

Engine Architecture & Dual Input Pipeline

Production Ready
Key Benefit: You can design, preview, and generate complete vector PDF stamp album pages directly within Stamp Album Generator 2. No external software installations, no external Ghostscript or PDF dependencies, and no file roundtripping required.

One Native Engine, Two Unified Input Paths

  • Canonical .stampalbum Document Format: The program's native UTF-8 command-based document structure (beginning with the STAMPALBUM 1 header). It gives stamp collectors direct, unconstrained access to advanced layout capabilities like true physical stamp mounting clearance, inner decorative borders, layered background fills, and sub-millimeter typography.
  • Built-in AlbumEasy .txt Compatibility: Existing AlbumEasy script files and external album libraries remain fully supported. The built-in bounded interpreter parses and maps AlbumEasy commands directly into our native layout model and renders them with the native PDF backend.
  • Standard Page Size: The standard default page size across all generators, fixtures, and documentation is US Letter (215.9 × 279.4 mm / 8.5 × 11.0 in), while international A4 (210.0 × 297.0 mm) and custom dimensions remain fully selectable.
Evidence-Based Verification: Every command family is validated against frozen golden fixtures (including authentic stamp collections from San Marino, New Zealand, Malta, Sweden, and the US 1847 archives) using our two-pass verification workflow and rendered native vector PDFs.

Native Engine Innovations for Stamp Collectors

Layout & Geometry

Separated Mounting Clearance

Unlike older paradigms where frame margins and stamp sizes were conflated, the native engine cleanly isolates the physical stamp dimensions from mount clearances (Hawid/Showgard), frame line thicknesses, and inner border insets.

Sub-millimeter Accuracy

Centered Row Alignment

The native engine features centered row alignment as its modern default: internal spacing and outer page margins are balanced equally across the printable area. Left, right, and justified modes remain available.

Balanced Margins

Bounded Typography (AFM)

Text footprints are measured with precise Adobe Font Metrics (AFM). Headings and multiline captions wrap or expand dynamically without distorting stamp frames or shifting adjacent stamp placements.

No Clipping

Caption Frame Clearance

Guarantees an explicit vertical clearance buffer between the bottom frame stroke and stamp caption text via NATIVE_STAMP_TEXT_POLICY, completely eliminating line bleeding and text collisions.

Zero Text Bleed

Multi-Borders & Edge Masks

Supports single, double, and triple concentric page borders (ALBUM_PAGES_BORDER), nested inner frames (SOLID, DOTTED, DASHED, BLANK), and selective edge masking.

Custom Framing

Smart Multi-Page Flow

Pagination automatically resolves total page count ($), header/footer reservations, section numbering, and odd/even margins iteratively without manual recalculation.

Multi-Page Pagination

The following commands are native to the .stampalbum canonical document language. Arguments are enclosed in parentheses and separated by spaces.

Native Command Category Description & Parameters Status
STAMPALBUM Document Header
Canonical document format header. Must be the first nonblank, noncomment line of any native document.
Parameters: 1: Version 1 specification.
Implemented
ALBUM_PAGES_SIZE(w_mm h_mm) Page Geometry
Configures page dimensions in exact millimeters. US Letter (215.9 x 279.4 mm) is the standard default; A4 and custom fractional dimensions are fully supported.
Parameters: w_mm, h_mm: Width and height in mm (e.g. 215.9 279.4).
Implemented
ALBUM_PAGES_MARGINS(left right top bottom) Page Geometry
Sets outer page margins in millimeters separating border strokes and printable content from physical sheet edges.
Parameters: left right top bottom: Decimal values in mm (e.g. 15.0 15.0 15.0 15.0).
Implemented
ALBUM_PAGES_MARGINSE(left right top bottom) Page Geometry
Sets alternating even-page margins in millimeters for two-sided printing and ring-binder punch hole clearances.
Parameters: left right top bottom: Inverts left/right margins for left-hand (even) pages.
Implemented
ALBUM_PAGES_SPACING(horiz_mm vert_mm) Page Geometry
Defines horizontal breathing room between adjacent stamps and vertical separation between successive rows.
Parameters: horiz_mm: Gap between stamp mounts.
vert_mm: Separation between rows.
Implemented
ALBUM_PAGES_BORDER(outer middle inner gap) Borders & Framing
Draws single, double, or triple concentric border rules around the page perimeter. 3-arg legacy syntax (outer inner gap) is also supported.
Parameters: outer middle inner: Stroke line weights in mm.
gap: Separation between concentric lines in mm.
Implemented
COLOUR_ALBUM_BORDER(colour_name) Borders & Framing
Applies a named color (e.g. black, darkblue, navy) or tint to page border strokes.
Parameters: colour_name: Named color string.
Implemented
ALBUM_TITLE("title") / ALBUM_AUTHOR ("author") Document Metadata
Embeds document title and author strings directly into PDF document information dictionary.
Parameters: Quoted UTF-8 text strings.
Implemented
NATIVE_PAGE_TITLE(font sz "text" gap_mm) Headers & Titles
Renders an authoritative commemorative album title above stamp rows with an explicit vertical buffer preventing border collision.
Parameters: font: PostScript font name.
sz: Point size.
text: Quoted title string.
gap_mm: Vertical clearance below title.
Implemented
NATIVE_PAGE_HEADER(font sz align "text" offset_x offset_y) Headers & Titles
Positions a running page header at the top of the content area with precise sub-millimeter coordinate offsets.
Parameters: align: LEFT, CENTRE, RIGHT.
offset_x offset_y: Offset adjustments in mm.
Implemented
NATIVE_PAGE_HEADER_NUMBER(font sz align start "pfx" "sfx" pad min_h col) Headers & Titles
Renders running page header numbering with dynamic total page count ($PAGES$) resolution.
Parameters: start: Initial page number.
pfx sfx: Prefix and suffix text strings.
col: Font color.
Implemented
NATIVE_PAGE_FOOTER_NUMBER(font sz align start "pfx" "sfx" pad min_h col) Footers & Pagination
Renders running footer page numbering with automatic total document page resolution (e.g. "Page 3 of 16").
Parameters: start: Starting counter offset.
pfx sfx: Prefix/suffix text.
pad: Distance from bottom border.
Implemented
NATIVE_PAGE_NUMBER_SECTION(start_num) Footers & Pagination
Resets page numbering counter for a new document section or chapter.
Parameters: start_num: Integer starting number for the section.
Implemented
NATIVE_PAGE_MARGIN_TEXT(font sz "txt" pos align dir gap col) Headers & Titles
Renders rotated vertical margin annotations along binder margins with odd/even page parity.
Parameters: pos: L, R, LR, RL.
align: TOP, CENTRE, BOTTOM.
dir: UP, DOWN.
Implemented
NATIVE_PAGE_BACKGROUND_IMAGE("path" scale opacity) Background & Media
Renders a background watermark or decorative artwork behind stamps and content.
Parameters: path: Image file path.
scale: Scaling factor.
opacity: Alpha transparency (0.0 to 1.0).
Implemented
NATIVE_ROW_ALIGNMENT(center|left|right) Row & Stamp Layout
Controls the horizontal distribution of stamps within each row. center is the standard native default for balanced, elegant layouts.
Parameters: center: Equal left/right margin distribution.
left: Left-aligned.
right: Right-aligned.
Implemented
NATIVE_ROW_VERTICAL_ALIGNMENT(top|middle|bottom) Row & Stamp Layout
Vertically aligns stamp mounts of varying heights within the same row.
Parameters: top, middle, or bottom alignment.
Implemented
NATIVE_ROW_BREAK() Row & Stamp Layout
Explicitly terminates the current stamp row and advances layout coordinates to the next row according to vertical spacing.
Parameters: Takes no arguments.
Implemented
NATIVE_PAGE_BREAK() Footers & Pagination
Explicitly terminates the current page and advances layout to the next page.
Parameters: Takes no arguments.
Implemented
NATIVE_STAMP_FRAME(pad_mm [thick_mm] | thick_mm colour [pad_mm]) Stamp Frames & Mounting
Defines physical stamp mount clearance and frame stroke thickness. Isolates physical stamp dimensions from mount clearance.
Parameters: pad_mm: Clearance between stamp edge and frame (mm).
thick_mm: Border stroke thickness.
colour: Stroke color.
Implemented
NATIVE_STAMP_TEXT_POLICY(expand_footprint percent threshold min_pt step_pt gap_mm | wrap_to_frame ...) Typography & Clearance
Advanced caption layout policy. Enforces a guaranteed vertical clearance gap (gap_mm) between the frame line and caption, and expands layout footprints up to threshold% to prevent font shrinking or clipping.
Parameters: expand_footprint: Permits footprint to expand horizontally.
gap_mm: Guaranteed frame-to-text gap.
min_pt: Minimum legible font size.
Implemented
NATIVE_STAMP_IMAGE_POLICY(unit offset_x offset_y clip aspect colour show) Background & Media
Precision controls for embedded stamp images including offset positioning, aspect ratio preservation, clipping, and grayscale conversion.
Parameters: aspect: preserve / stretch.
colour: colour / grayscale.
show: show / hide.
Implemented
NATIVE_STAMP_INNER_BORDER(pad thick style col) Borders & Framing
Renders an inset decorative secondary frame inside the mounting box.
Parameters: pad: Inset from outer frame.
thick: Line width.
style: SOLID, DOTTED, DASHED, DOT_DASH, BLANK.
col: Named color.
Implemented
NATIVE_STAMP_BORDER_STYLE/ INNER_BORDER_STYLE (selector style) Borders & Framing
Selective edge and corner masking for outer or inner frames using corner and side selectors.
Parameters: selector: ALL, SIDES, C1_C3, C2_C4, etc.
style: Line style enum.
Implemented
NATIVE_STAMP_BACKGROUND(colour|none) Background & Media
Sets a solid background fill color behind the stamp image within the mounting frame.
Parameters: colour: Named color (e.g. black, lightblue) or none.
Implemented
NATIVE_STAMP_OUTLINE(show|hide) Stamp Frames & Mounting
Controls outer frame stroke visibility while preserving background fills and mounting reservations.
Parameters: show: Draws boundary frame.
hide: Suppresses frame line.
Implemented
NATIVE_STAMP_SETTINGS_SAVE() / RESTORE () State Management
Captures and restores mutable stamp drawing state (image options, borders, background colors) in a verified snapshot scope.
Parameters: Takes no arguments. Restoring without a saved state produces an explicit error.
Implemented
NATIVE_STAMP_HEADING(font sz "heading") Headers & Titles
Multi-line heading text positioned immediately above a specific stamp frame.
Parameters: font, sz: Font family and pt size.
heading: Quoted heading string.
Implemented
NATIVE_STAMP_FOOTER_TEXT(font sz "footer") Typography & Clearance
Multi-line footer text positioned directly below a specific stamp frame with custom padding and alignment.
Parameters: font, sz: Font family and pt size.
footer: Quoted footer string.
Implemented
NATIVE_STAMP_IMAGE_LABEL("label" [font sz offset_x offset_y col]) Background & Media
Renders an overlay specimen or watermark label directly inside the stamp frame.
Parameters: label: Text string.
offset_x offset_y: Offset coordinates.
Implemented
STAMP_IMAGE("path" w h scale "font" sz "caption") Row & Stamp Layout
Places an authentic stamp image with physical mount dimensions, image asset path, and optional multi-line caption.
Parameters: path: Image file path.
w h: Mount dimensions in mm.
scale: Scale multiplier.
font sz caption: Typography & caption.
Implemented

When Stamp Album Generator 2 encounters an AlbumEasy .txt file (or a file without the STAMPALBUM header), it dispatches the file to our native bounded interpreter. The interpreter translates standard commands directly into the native rendering pipeline without executing external binaries:

AlbumEasy Command Category Native Mapping Behavior Current Status
ALBUM_PAGES_SIZE Page Setup Sets page width and height; maps directly to native MediaBox point coordinates. Native Mapped
ALBUM_PAGES_MARGINS Page Setup Sets outer margin boundaries separating border strokes and content from page edges. Native Mapped
ALBUM_PAGES_MARGINSE Page Setup Sets alternating even-page margins for duplex printing and ring-binder punch hole clearances. Native Mapped
ALBUM_PAGES_SPACING Page Setup Maps horizontal element spacing and vertical row separation with exact mathematical consistency. Native Mapped
PAGE_START Page Setup Initiates a new page; flushes active rows, resolves headers, titles, and layout bounds. Native Mapped
PAGE_START_VAR Page Setup Initiates a page with per-page horizontal and vertical spacing overrides. Native Mapped
PAGE_START_GROUP_BEGIN / END Page Setup Defines reusable page layout templates with positional argument substitution ($$1..$$9). Native Mapped
PAGE_VSPACE Page Setup Inserts explicit vertical space between elements, titles, and stamp rows. Native Mapped
ALBUM_PAGES_BORDER Borders & Framing Renders single, double, or triple page borders. Defaults gracefully to no border when omitted. Native Mapped
COLOUR_ALBUM_BORDER / COLOR_ALBUM_BORDER Borders & Framing Applies named color or grayscale tint to page perimeter border rules. Native Mapped
STAMP_BOXES_SIZE_ADJUST Borders & Framing Uniformly inflates or deflates all following stamp mount dimensions by a fixed millimeter delta. Native Mapped
STAMP_BORDER_STYLE Borders & Framing Selects line styles (SOLID, DOTTED, DASHED) and edge masks for stamp mounting frames. Native Mapped
STAMP_INNER_BORDER Borders & Framing Configures an inset secondary decorative border inside the outer stamp frame. Native Mapped
STAMP_INNER_BORDER_STYLE Borders & Framing Selects line styles and corner masks for the secondary inner decorative frame. Native Mapped
COLOUR_STAMP_INNER_BORDER / COLOR_STAMP_INNER_BORDER Borders & Framing Sets the stroke color of the secondary inner stamp border. Native Mapped
COLOUR_STAMP_BORDER / COLOR_STAMP_BORDER Borders & Framing Sets the stroke color of the outer stamp frame. Native Mapped
ALBUM_TITLE / ALBUM_AUTHOR Headers & Titles Embeds document title and author metadata into PDF document information dictionary. Native Mapped
ALBUM_PAGES_TITLE / COLOUR_ALBUM_TITLE Headers & Titles Renders document series titles with configurable bottom gap buffer and color. Native Mapped
ALBUM_PAGES_HEADER Headers & Titles Renders running page header text positioned at page top (LEFT, CENTRE, RIGHT). Native Mapped
ALBUM_PAGES_HEADER_NUMBER / PAD Headers & Titles Renders page header numbering with dynamic $PAGES$ total page count resolution. Native Mapped
ALBUM_PAGES_FOOTER_NUMBER / PAD Footers & Pagination Renders running page footer with automatic total page resolution (e.g. "Page 3 of 16"). Native Mapped
COLOUR_ALBUM_HEADER / COLOR_ALBUM_HEADER Headers & Titles Sets the color of running page headers and header page numbers. Native Mapped
COLOUR_ALBUM_FOOTER / COLOR_ALBUM_FOOTER Footers & Pagination Sets the color of running page footers and footer page numbers. Native Mapped
ALBUM_PAGES_MARGIN_TXT / PAD Headers & Titles Renders rotated vertical margin annotations along binder edges with odd/even parity. Native Mapped
COLOUR_ALBUM_MARGIN_TXT / COLOR_ALBUM_MARGIN_TXT Headers & Titles Sets the font color of rotated vertical margin annotations. Native Mapped
PAGE_TEXT Typography Renders left-aligned page body text with precise Adobe Font Metrics (AFM) bounding. Native Mapped
PAGE_TEXT_CENTRE Typography Renders centered page text balanced horizontally across usable content margins. Native Mapped
PAGE_TEXT_RIGHT Typography Renders right-aligned page text aligned to the right margin border. Native Mapped
TEXT_LINE_LEADING Typography Configures inter-line baseline distance for multi-line paragraph and caption blocks. Native Mapped
ROW_START_ES Row & Stamp Layout Begins a stamp row with equal spacing distributed between outer margins and stamps. Native Mapped
ROW_START_FS Row & Stamp Layout Begins a stamp row with fixed inter-stamp spacing, centered across the printable width. Native Mapped
ROW_ALIGN_TOP / MIDDLE / BOTTOM Row & Stamp Layout Vertically aligns stamp mounts of varying heights within the active row. Native Mapped
STAMP_ADD_IMG Row & Stamp Layout Places a stamp mount with image asset, dimensions, caption, heading, and inside-frame text. Native Mapped
STAMP_HEADING / PADDING / VA Row & Stamp Layout Renders multi-line heading text positioned directly above a specific stamp mount. Native Mapped
STAMP_FOOTER_TXT_ALIGN / PAD Row & Stamp Layout Controls alignment and padding for stamp caption and footer annotations. Native Mapped
COLOUR_STAMP_TEXT / COLOR_STAMP_TEXT Typography Sets the text color of stamp captions. Native Mapped
COLOUR_STAMP_HEADING / COLOR_STAMP_HEADING Typography Sets the text color of stamp headings. Native Mapped
COLOR_STAMP_BACKGROUND / COLOUR_STAMP_BACKGROUND Background & Media Applies solid color background fill behind the stamp image within the frame. Native Mapped
ALBUM_STAMP_IMG_NEW_SETTING / PCNT Background & Media Configures image border padding, grayscale mode, aspect ratio, and visibility. Native Mapped
ALBUM_STAMP_IMG_ASPECT_RATIO Background & Media Controls whether embedded stamp images maintain true aspect ratio or fill mount. Native Mapped
ALBUM_STAMP_IMG_GREYSCALE_ON / OFF Background & Media Converts color stamp images to high-contrast monochrome grayscale. Native Mapped
ALBUM_STAMP_IMG_HIDE / SHOW Background & Media Toggles image rendering while strictly preserving stamp mount frame geometry. Native Mapped
ALBUM_STAMP_SETTINGS_SAVE / RESTORE State Management Captures and restores mutable stamp drawing state in a verified snapshot scope. Native Mapped
Strict Error Reporting: The native interpreter never silently ignores unmapped commands or drops text. Any unsupported command or malformed parameter is explicitly reported with its source line number to ensure complete layout fidelity.

Example Canonical Document (.stampalbum)

Code Walkthrough

Here is a complete, standalone .stampalbum document demonstrating the canonical format, US Letter dimensions, centered row alignment, caption text policies, inner borders, and dynamic footer numbering:

# ==============================================================================
# Sample Canonical Document: United States 1938 Presidential Series
# Standard US Letter Format (215.9 x 279.4 mm)
# ==============================================================================
STAMPALBUM 1

ALBUM_PAGES_SIZE (215.9 279.4)
ALBUM_PAGES_MARGINS (15.0 15.0 15.0 15.0)
ALBUM_PAGES_SPACING (4.0 10.0)
ALBUM_PAGES_BORDER (0.5 0.1 0.0 1.25)
COLOUR_ALBUM_BORDER (black)

# Document Header & Layout Policies
NATIVE_PAGE_TITLE (TB 16 "UNITED STATES - 1938 PREXIES" 10.0)
NATIVE_ROW_ALIGNMENT (center)
NATIVE_STAMP_FRAME (0.25 black 2.0)
NATIVE_STAMP_TEXT_POLICY (expand_footprint percent 140 2.0 1.0 2.5)
NATIVE_PAGE_MARGIN_TEXT ("Helvetica" 8 "United States Collection" LR CENTRE UP 2.0 darkblue)
NATIVE_PAGE_FOOTER_NUMBER ("Helvetica" 9 CENTRE 1 "Page " " of " 10.0 6.0 darkblue)

# Stamp Row 1: 3 Cent Washington & 5 Cent Monroe
STAMP_IMAGE ("../spacing-v1/images/san-marino.jpg" 35.0 26.0 0.175 "HN" 8 "3c Washington\nDeep Violet")
STAMP_IMAGE ("../spacing-v1/images/new-zealand.jpg" 36.0 22.0 0.162 "HN" 8 "5c Monroe\nBright Blue")
NATIVE_ROW_BREAK ()

# Stamp Row 2: Airmail Transatlantic Issue with custom background
NATIVE_STAMP_SETTINGS_SAVE ()
NATIVE_STAMP_BACKGROUND (lightblue)
NATIVE_STAMP_INNER_BORDER (1.0 0.2 SOLID darkblue)
STAMP_IMAGE ("../spacing-v1/images/malta.jpg" 22.0 34.0 0.155 "HN" 8 "30c Transatlantic\nAirmail Issue")
NATIVE_STAMP_SETTINGS_RESTORE ()

You can render this file directly into publication-quality vector PDFs using Stamp Album Generator 2!

Next Steps & Related Documentation

Album Examples Gallery

Explore live rendered PDF album pages, download source code, and inspect high-resolution thumbnails across all 43 verified command families.

Getting Started

Download the latest release binary, configure your directories, and start your first review workflow.

AlbumEasy Compatibility

Detailed tracking of AlbumEasy v4.2.1 and v4.5.0 commands, syntax verification, and import coverage.

Configuration Reference

Explore configuration parameters for row alignment, font sizing, and native PDF layout policies.