Download Latest Version openpublisher5g_amd64-windows.exe (81.1 MB)
Home / 5.3.2
Name Modified Size InfoDownloads / Week
Parent folder
OpenPublisher-5-x86_64.AppImage 2026-10-04 166.4 MB
openpublisher5_amd64-windows-portable.exe 2026-10-04 183.2 MB
openpublisher5_amd64-windows.exe 2026-10-04 165.2 MB
openpublisher5_amd64-macos.dmg 2026-10-04 233.1 MB
openpublisher5_amd64-linux.run 2026-10-04 193.4 MB
5.3.2_ Smart Arrows Stroke Bleed _ Overflow Print Cropping Fix source code.tar.gz 2026-10-04 22.4 MB
5.3.2_ Smart Arrows Stroke Bleed _ Overflow Print Cropping Fix source code.zip 2026-10-04 22.7 MB
README.md 2026-10-04 11.7 kB
openpublisher5_amd64-linux.rpm 2026-10-04 215.4 MB
openpublisher5_amd64-linux.flatpak 2026-10-04 153.6 MB
openpublisher5_amd64-linux.deb 2026-10-04 156.2 MB
openpublisher5_amd64-freebsd.pkg 2026-10-04 185.5 MB
Totals: 12 Items   1.7 GB 0

πŸš€ Summary

Version 5.3.2 resolves a vector clipping issue in the Smart Arrows Engine where custom outlines and borders extending outside an arrow element's selection bounding box were truncated with flat, cropped edges in printed output and PDF exports.

When users applied thick borders (e.g., 24px) to Smart Arrows in the live canvas, the vector outline with rounded joins and end caps naturally projected beyond the element's bounding rectangle. While the live browser editor seamlessly rendered this overflow, high-resolution rasterization during print spooling and PDF generation strictly bounded the 2D canvas to the element dimensions [0, w] x [0, h]. Consequently, arrow tips, barb wing corners, and shaft end caps extending into negative coordinates or beyond the width and height were clipped into flat edges.

Version 5.3.2 introduces dynamic stroke bleed padding calculations, coordinate translation in the HTML5 2D canvas, and negative offset positioning for baked print images. This guarantees that printed documents and exported PDFs faithfully preserve 100% of the rounded caps, corner joins, and stroke extensions with pixel-perfect fidelity.

In addition, version 5.3.2 updates the Service Worker cache (open-publisher-v5-3-2), refreshes PWA registration (sw.js?v=5.3.2), and synchronizes cachebusters across all application components to ?v=5.3.2.


πŸ” Context & Problem Analysis

In version 5.3.0, the Smart Arrows Engine introduced parametric vector arrows with stem-only stretching, custom arrowhead lengths, and adjustable outline thickness (0px to 24px+).

The Root Cause of Print Cropping

  1. Centred Vector Strokes: In SVG rendering, strokes are centred along the path geometry (stroke-alignment: center). For a stroke width of 24px, the stroke extends 12px outwards and 12px inwards from the path coordinates. At sharp vertices (such as the arrow tip point or arrowhead wings), rounded corner joins (stroke-linejoin="round") and miter joins project up to 1.5x the stroke width beyond the nominal path boundary.

  2. Editor vs. Print Renderer Discrepancy:

  3. In-Editor Display: The live editor displays the SVG within .element-content, which has overflow: visible;. The SVG vector stroke naturally renders beyond the dotted selection box without truncation.
  4. Print Spooler & PDF Export: During print preparation in extensions/print-engine.js, bakeSmartArrowForPrint serialized the arrow onto an HTML5 2D canvas created strictly at w * scaleFactor by h * scaleFactor. Because HTML5 2D canvas boundaries hard-clip any drawing operations where x < 0, y < 0, x > targetW, or y > targetH, the outer half of the stroke was clipped into flat horizontal and vertical edges.
  5. Image Placement: The resulting canvas PNG was inserted into .element-content with style="width: 100%; height: 100%; object-fit: fill;", displaying the flat chopped edges on the exported page.

πŸ› οΈ Architectural Solution & Implementation

1. Dynamic Stroke Bleed Padding Calculation

bakeSmartArrowForPrint now evaluates the effective stroke width and whether a visible stroke exists:

:::javascript
const attrStrokeWidth = path.getAttribute('stroke-width') ?? arrowEl.getAttribute('data-arrow-stroke-width');
let strokeWidth = attrStrokeWidth !== null ? parseFloat(attrStrokeWidth) : 2;
const hasStroke = stroke && stroke !== 'none' && stroke !== 'transparent' && strokeWidth > 0;

// Calculate stroke bleed padding so thick borders and joins extending beyond the bounding box are never clipped
const pad = hasStroke ? Math.ceil(Math.max(20, strokeWidth * 1.5 + 4)) : 0;

For a 24px stroke, this provides 40px of transparent safety margin on all four sides.

2. Canvas Expansion & Coordinate Space Translation

The rendering canvas is expanded by pad * 2 horizontally and vertically:

:::javascript
const targetW = Math.max(16, Math.round((w + pad * 2) * scaleFactor));
const targetH = Math.max(16, Math.round((h + pad * 2) * scaleFactor));
canvas.width = targetW;
canvas.height = targetH;
const ctx = canvas.getContext('2d');

ctx.scale(scaleFactor, scaleFactor);
if (pad > 0) {
    ctx.translate(pad, pad);
}

With ctx.translate(pad, pad), the origin (0, 0) of the path is shifted inwards to (pad, pad). Any stroke cap, round join, or corner extending into negative coordinates lands safely in the transparent margin [0, pad] without clipping.

3. Precision Negative Offset Image Positioning

The baked image is positioned with negative offsets equal to -pad:

:::html
<img class="smart-arrow-baked-img" 
     src="${pngUrl}" 
     style="position: absolute !important; 
            top: -${pad}px !important; 
            left: -${pad}px !important; 
            width: ${w + pad * 2}px !important; 
            height: ${h + pad * 2}px !important; 
            max-width: none !important; 
            max-height: none !important; 
            object-fit: fill !important; 
            display: block !important; 
            pointer-events: none !important;" 
     alt="Smart Arrow">

Mathematical Invariance: The top-left corner of the image is at (-pad, -pad). Inside the image, the arrow origin (0, 0) is located at (pad, pad). -pad + pad = 0px relative to .element-content. The arrow path aligns with 100% pixel-perfect precision to the live editor SVG, while the stroke bleed seamlessly extends beyond the bounding box.

4. Container Overflow & Image Style Rules

  • arrowEl.style.overflow = 'visible', content.style.overflow = 'visible', and content.parentElement.style.overflow = 'visible' ensure no container clips the bleed.
  • Added dedicated CSS in style.css: css .element-content img.smart-arrow-baked-img { max-width: none !important; max-height: none !important; object-fit: fill !important; pointer-events: none !important; display: block !important; }

5. Asynchronous Image Decoding in Print Spooler

bakeSmartArrowForPrint now returns the created HTMLImageElement. In installPhysicalPrintEngine, the print engine awaits loadImageStrict(bakedImg, bakedImg.src) before html2canvas rasterizes the page, eliminating race conditions during print spooling.


πŸ› οΈ Files Modified

  • arrow.js: Implemented dynamic stroke bleed calculation, canvas translation, negative padding offset placement, and image reference return in bakeSmartArrowForPrint. Updated header comment and console log to v5.3.2.
  • style.css: Added .element-content img.smart-arrow-baked-img rule to ensure baked print images expand beyond bounding box limits without restriction.
  • print-engine.js: Enhanced query selectors for Smart Arrows to include .smart-arrow-svg targets, and added asynchronous loadImageStrict awaiting for baked arrow images during PDF and physical print compilation.
  • index.html: Bumped all script, stylesheet, and asset cachebusters across the application to ?v=5.3.2.
  • sw.js: Bumped Service Worker cache name to open-publisher-v5-3-2 and updated header comment.
  • pwa-install.js: Updated Service Worker registration to sw.js?v=5.3.2 and bumped header comment to (v5.3.2).
  • geo-defense.js: Bumped version header comment to (v5.3.2).
  • dashboard.js: Bumped template index and template file fetch queries to ?v=5.3.2.
  • templates.js: Bumped template index and template file fetch queries to ?v=5.3.2.

πŸ§ͺ Verification & Automated Testing

All updates were validated through automated Playwright end-to-end tests:

Test Scenario Verification Metric Result Output Details
In-Editor Stroke Bleed Block Left Arrow with 24px stroke and 100px tip Passed Rounded stroke projects smoothly beyond selection boundaries
Canvas Serialization Dimensions bakeSmartArrowForPrint with w=300, h=80, strokeWidth=24 Passed Canvas expands with pad=40 to 380x160 (1520x640 at 4.0x)
Stroke Cap Preservation Inspection of serialized PNG (v5_3_2_raw_canvas.png) Passed Tip, wings, and shaft caps retain rounded geometry without flat clipping
DOM Image Alignment Negative offset positioning in .element-content Passed Image placed at top: -40px, left: -40px, width: 380px, height: 160px
Print Spooler Integration buildPrintDOM and installPhysicalPrintEngine execution Passed Baked arrow images detected, processed, and awaited with loadImageStrict
Browser Runtime Stability Console error monitoring Passed 0 JavaScript errors or unhandled exceptions

βœ… Checklist Completed

  • [x] Dynamic Stroke Bleed Calculation: Evaluates border thickness and applies pad = Math.ceil(Math.max(20, strokeWidth * 1.5 + 4)) to prevent clipping on thick outlines.
  • [x] 2D Canvas Bleed Margin Expansion: Expands HTML5 raster canvas by pad * 2 horizontally and vertically at 4.0x print scale.
  • [x] Coordinate Space Translation: Applies ctx.translate(pad, pad) so the vector path origin shifts safely inwards, capturing the entire stroke cap and miter area.
  • [x] 100% Round Join & Cap Geometry Preservation: Preserves curved arrow tips, barb wing corners, and rounded shaft caps without flat truncated edges.
  • [x] Precision Negative Offset Positioning: Positions baked image with top: -${pad}px; left: -${pad}px; width: ${w + pad * 2}px; height: ${h + pad * 2}px; to cancel translation and align with zero pixel deviation.
  • [x] Container Overflow Visibility: Sets overflow: visible on element, content, and parent wrappers so stroke overflow renders unimpeded.
  • [x] Dedicated CSS Bleed Override: Added .element-content img.smart-arrow-baked-img rule in style.css to prevent max-width or max-height bounding box constriction.
  • [x] Asynchronous Image Decoding Awaiting: Returns HTMLImageElement from bakeSmartArrowForPrint and awaits loadImageStrict before html2canvas rasterization in the physical print engine.
  • [x] Multi-Target Arrow Spooler Query: Broadened print spooler selector to capture .smart-arrow-svg instances alongside [data-type="smart-arrow"] with deduplication.
  • [x] Zero Selection Drift: Arrow geometry and dotted selection box remain 100% pixel-aligned with live vector SVG before and after baking.
  • [x] Full Version 5.3.2 Synchronization: Updated Service Worker cache (open-publisher-v5-3-2), PWA installer, module headers, template fetchers, and all 77 cachebusters in index.html.
  • [x] Automated Verification: Validated via automated Playwright test suite with verified screenshot artifacts and 0 console errors.

πŸŽ‰ Version 5.3.2 - Open Publisher

Source: README.md, updated 2026-10-04