| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| OpenPublisher-5-x86_64.AppImage | 2026-10-12 | 166.4 MB | |
| openpublisher5_amd64-windows-portable.exe | 2026-10-12 | 183.2 MB | |
| openpublisher5_amd64-windows.exe | 2026-10-12 | 165.2 MB | |
| openpublisher5_amd64-macos.dmg | 2026-10-12 | 233.1 MB | |
| openpublisher5_amd64-linux.run | 2026-10-12 | 193.4 MB | |
| openpublisher5_amd64-linux.rpm | 2026-10-12 | 215.4 MB | |
| openpublisher5_amd64-linux.flatpak | 2026-10-12 | 153.6 MB | |
| openpublisher5_amd64-linux.deb | 2026-10-12 | 156.2 MB | |
| openpublisher5_amd64-freebsd.pkg | 2026-10-12 | 185.5 MB | |
| 5.7.4_ Print Engine html2canvas Background Parsing Fix _ Export Resilience source code.tar.gz | 2026-10-12 | 22.5 MB | |
| 5.7.4_ Print Engine html2canvas Background Parsing Fix _ Export Resilience source code.zip | 2026-10-12 | 22.8 MB | |
| README.md | 2026-10-12 | 7.0 kB | |
| Totals: 12 Items | 1.7 GB | 0 | |
🚀 Summary
Version 5.7.4 resolves a critical print engine failure where attempting to print documents containing image backgrounds, data URLs, or compound CSS background rules resulted in an immediate "Print Error: Failed to generate print file." alert dialog.
The issue stemmed from passing complex CSS background shorthand strings into the backgroundColor parameter of html2canvas. This triggered an internal CSS parser SyntaxError that halted page rasterization across all print scale passes.
The fix introduces centralized background color sanitization, defensive rasterization fallbacks in the physical print engine, and safeguards across both image and email export pipelines.
🔍 Problems Solved & Root Cause Analysis
1. html2canvas parseColor Syntax Rejection on Compound Backgrounds
- Root Cause: In
extensions/print-engine.js, the rasterization loop computedlet h2cBg = page.background || '#ffffff'. While linear/radial gradients were guarded against (if (h2cBg.includes('gradient')) h2cBg = null;), image URLs (url(...)) and compound CSS shorthand strings (e.g.url("data:image/webp;base64,...") center center / cover no-repeat) were passed directly intohtml2canvas(pageWrapper, { backgroundColor: h2cBg }). - The Failure: The
html2canvaslibrary strictly parses itsbackgroundColoroption as a single CSS<color>value. Passing multiple space-separated tokens orurl(...)structures causedParser.create(value).parseComponentValue()to encounter multiple component values where only one was expected, throwing:SyntaxError: Error parsing CSS component value, multiple values found when expecting only one at YA.parseComponentValue (html2canvas.min.js:20:71245) at fe (html2canvas.min.js:20:76047) - The Resulting Behavior: Because the fallback pass at lower resolution also passed
backgroundColor: h2cBg, both attempts failed instantly, triggeringDialogSystem.alert('Print Error', 'Failed to generate print file.'). - The Fix: Introduced
window.sanitizeH2cBackgroundColor(bg, hasActiveTheme)incore/core.js. It validates whether a string matches a strict single CSS color (#hex,rgb(...),rgba(...),hsl(...),hsla(...), or single named color). If the background containsurl(...),gradient, shorthand tokens, or an active theme, it returnsnull(transparent canvas). BecausepageWrapper.style.backgroundalready applies the full CSS background to the DOM element itself,html2canvasrenders the background imagery and styling directly on the element without crashing the canvas background parser.
2. Multi-Tier Defensive Fallback in Physical Print Engine
- Root Cause: Previously, if the primary 300 DPI rasterization pass failed or timed out, the fallback scale pass repeated the identical options without isolating potential parameter errors.
- The Fix: In
extensions/print-engine.js, the fallback pass is now wrapped in a nested try/catch block. If rasterization with a background color ever encounters an unexpected error, it immediately executes an emergency retry usingbackgroundColor: nullbefore failing, ensuring documents print reliably even under edge-case background definitions.
3. Image Export & Email HTML Export Resilience
- Root Cause: In
io/export/canvas-renderer.js(used for "Export to Image") andio/export/export.js(used for HTML email export),html2canvaswas invoked withpage.background || '#ffffff'without sanitization, leaving these features susceptible to identical crashes when exporting documents with image or complex backgrounds. - The Fix: Both export pipelines now route background colors through
window.sanitizeH2cBackgroundColor, completely eliminating the syntax error vector during canvas and email generation.
📁 Files Modified
| File | Changes |
|---|---|
core/core.js |
Added window.sanitizeH2cBackgroundColor(bg, hasActiveTheme) utility to validate CSS color strings and return null for compound backgrounds, image URLs, gradients, and active theme environments. |
extensions/print-engine.js |
Sanitized h2cBg using window.sanitizeH2cBackgroundColor. Added a secondary defensive fallback with backgroundColor: null in case rasterization encounters parameter errors. Bumped print sequence log string to v5.7.4. |
io/export/canvas-renderer.js |
Updated capturePageAsCanvasWithFilters() to sanitize background color before passing to html2canvas for high-resolution image exports. |
io/export/export.js |
Updated exportAsHTML() email rasterizer to sanitize background color before passing to html2canvas. |
index.html |
Synchronized all 83 asset cachebuster queries from ?v=5.7.3 to ?v=5.7.4. |
sw.js |
Bumped Service Worker cache name to open-publisher-v5-7-4 and header comment to (v5.7.4). |
extensions/pwa-install.js |
Bumped header comment to (v5.7.4) and updated Service Worker registration query to sw.js?v=5.7.4. |
extensions/ui-interactions.js |
Bumped About modal subtitle version string to • v5.7.4. |
extensions/legacy-fixes.js |
Bumped initialization log string to v5.7.4. |
ui/dashboard.js |
Updated template fetch cachebuster queries to ?v=5.7.4. |
ui/modals/options-modal.js |
Bumped header comment to (v5.7.4). |
ui/sidebar-context.js |
Bumped header comment to (v5.7.4). |
✅ v5.7.4 Verification Checklist
- [x] Complex Image Background Printing: Confirmed documents with base64 data URLs, WEBP/PNG image backgrounds, and shorthand formatting print without throwing
SyntaxError. - [x] Zero Modal Rejections: Verified that
DialogSystem.alert('Print Error', ...)is not triggered during print generation for documents with image backgrounds. - [x] html2canvas Color Sanitizer: Verified that
window.sanitizeH2cBackgroundColorcorrectly permits hex, rgb, rgba, hsl, hsla, and named colors while safely returningnullfor gradients, URLs, and multi-token CSS shorthands. - [x] Multi-Tier Print Fallback: Verified that the print engine includes emergency transparent retries if rasterization encounters any parameter anomalies.
- [x] Image Export Parity: Verified that
capturePageAsCanvasWithFiltersinio/export/canvas-renderer.jssafely renders documents with image backgrounds. - [x] Email Export Parity: Verified that
exportAsHTMLinio/export/export.jssafely renders email attachment canvases. - [x] Cachebuster Synchronization: Verified all 83 asset queries in
index.htmlandui/dashboard.jsare updated to?v=5.7.4. - [x] Service Worker Cache: Verified cache name in
sw.jsis updated toopen-publisher-v5-7-4. - [x] Automated Test Suite: Executed end-to-end automated tests with clean execution and zero console syntax errors.
🎉 Version 5.7.4 - Open Publisher