Smart Arrow Printing Engine & Export Visibility Architecture

Smart Arrow Printing Engine & Export Visibility Architecture

A primary requirement of professional desktop publishing software is absolute export reliability: every graphic designed on screen must appear in final output with identical positioning, color, and sharpness. In version 5.3.4, Open Publisher resolved a critical regression where Smart Arrows disappeared from printed pages, PDF documents, and image exports due to an invalid DOM nesting structure during rasterization. The updated export architecture guarantees 100% visibility, crisp vector rendering, and zero edge clipping.

🖨️Clean Print Spooler DOM & High-DPI Arrow Export

OP ArrowSpoolSmart Arrows are converted into clean high-resolution image elements during print staging, ensuring complete visibility across all printers.

The Root Cause of Invisible Printed Arrows

Deep architectural auditing revealed three interconnected flaws in the print staging pipeline:

  • Invalid HTML-in-SVG Insertion: In prior iterations, bakeSmartArrowForPrint() targeted the inner element container. When executed on print staging divs, it mistakenly inserted an HTML <img> directly inside the <svg> tag (<svg><img></svg>). Modern browser print engines and html2canvas discard illegal HTML inside SVG, causing arrows to vanish completely.

  • Attribute Loss in Print DOM: Print staging elements created in buildPrintDOM() and printFullDocument() omitted custom data attributes, causing arrows to collapse to default dimensions.

  • Detached Theme Variable Invalidation: Offscreen print staging containers could not resolve CSS custom properties (such as var(--ui-theme-color)), leading to transparent or blank fills.

The Robust Node-Replacement Engine

Version 5.3.4 re-engineered the print baking pipeline in elements/arrow/arrow.js and extensions/print-engine.js:

  • Clean Node Replacement: Replaced innerHTML injection with explicit DOM replacement: svg.parentNode.replaceChild(img, svg). The baked high-resolution <img> completely replaces the SVG node, guaranteeing valid DOM structure.

  • Self-Describing SVGs: Stamped style IDs, tip lengths, and stroke properties directly onto SVG root attributes. SVGs now carry their own complete geometry metadata even when processed in isolated print threads.

  • Staging Attribute Preservation: Updated print staging builders to copy all arrow attributes (data-type, data-arrow-style, data-arrow-head, data-arrow-stroke-width) onto staging elements.

  • Universal Export Coverage: Integrated arrow pre-baking across native browser print spooling, PDF document generation, image export, and email HTML attachments.

Tip: Baked print images include dynamic stroke bleed margins, ensuring thick decorative borders never suffer from clipped corners on paper or PDF.