Download Latest Version openpublisher5g_amd64-windows.exe (81.1 MB)
Home / 5.1.6
Name Modified Size InfoDownloads / Week
Parent folder
openpublisher5_amd64-windows-portable.exe 2026-09-26 183.2 MB
openpublisher5_amd64-windows.exe 2026-09-26 165.2 MB
openpublisher5_amd64-macos.dmg 2026-09-26 233.1 MB
openpublisher5_amd64-linux.run 2026-09-26 193.4 MB
openpublisher5_amd64-linux.rpm 2026-09-26 215.4 MB
openpublisher5_amd64-linux.flatpak 2026-09-26 153.6 MB
openpublisher5_amd64-linux.deb 2026-09-26 156.2 MB
openpublisher5_amd64-linux.AppImage 2026-09-26 176.6 MB
openpublisher5_amd64-freebsd.pkg 2026-09-26 185.5 MB
5.1.6_ High-DPI Paper Format _ Resolution Persistence Architecture source code.tar.gz 2026-09-26 21.5 MB
5.1.6_ High-DPI Paper Format _ Resolution Persistence Architecture source code.zip 2026-09-26 21.7 MB
README.md 2026-09-26 11.9 kB
Totals: 12 Items   1.7 GB 0

🚀 Summary

Version 5.1.6 resolves a document persistence issue in Open Publisher where publications configured with high-DPI resolutions (such as A4 or Letter at 300 DPI) were identified as "Custom" page sizes when reloaded, and the status bar resolution badge reverted to 96 DPI. Previously, users had to reopen the "Change Size" dialog to manually reset their paper format and DPI every time they loaded a saved publication.

This release establishes an authoritative format and DPI contract across all layers of Open Publisher: serialization, the native file loader, the Dashboard recent documents system, multi-page creation, template loading, and physical unit conversion services.

[!IMPORTANT] Action Required for Existing Publications: If you have an existing publication created in an earlier version, please open it, set your desired paper size and DPI via the Change Size dialog (or click the DPI badge on the status bar), and then re-save the publication. Once re-saved in version 5.1.6, your file will permanently retain both the chosen paper format and DPI whenever it is opened or loaded from recent files.


🔍 Root Cause Analysis

Investigation revealed six interrelated factors contributing to the paper size and DPI reversion:

  1. Absence of Explicit Format Property in Saved Document Schemas:
  2. Neither state.format nor page.format was serialized in .opub / .json publication files or history page snapshots.
  3. When loading, the application attempted to reverse-engineer the paper format solely by matching pixel dimensions (paper.style.width and height) against predefined presets at default 96 DPI.
  4. For an A4 sheet at 300 DPI (2480px x 3508px), testing against 96 DPI calculated physical dimensions of 25.8 inches by 36.5 inches (over 2 feet wide), which matched no standard paper size and thus fell back to "Custom".

  5. DPI Loss in Dashboard Recent Files Restoration:

  6. In ui/dashboard.js, clicking a recent publication card previously restored pages, history, and metadata but completely omitted state.dpi.
  7. Consequently, state.dpi remained stuck at the global default of 96, immediately breaking resolution-dependent layout calculations and displaying "96 DPI" on the status bar.

  8. Missing UI Badge & Indicator Synchronization in File Loaders:

  9. io/publisher-file-loader.js successfully parsed publication files but omitted invoking window.updateDpiDisplay(state.dpi) and window.setPageFormatIcon(state.format).
  10. As a result, the top-right format badge and status bar DPI display remained un-synchronized until the user manually manipulated canvas controls.

  11. Arithmetic Bug in Millimeter Physical Unit Conversion:

  12. In core/units.js, converting millimeters to inches in UnitConversionService.toPixels erroneously divided by 2.54 instead of 25.4 (confusing centimeters with millimeters).
  13. This caused millimeter-based format checks to fail by an order of magnitude.

  14. Fixed Pixel Tolerance in Format Detection:

  15. UnitConversionService.detectFormat(w, h, dpi) used a static tolerance of 2 pixels (Math.abs(w - pw) <= 2).
  16. At 300 DPI, standard rounding of physical millimeter measurements produces dimension variations of up to 4 to 8 pixels (for example, A4 is 2480px or 2481px depending on rounding direction), causing high-resolution standard presets to fail detection.

  17. Template Loading Format Collisions:

  18. In extensions/ui-interactions.js and elements/templates/templates.js, the template loading handler inspected t.w which was undefined on native .opub objects, defaulting fmt = 'A4' across all non-A4 templates and failing to preserve custom DPI configurations.

🛠️ Enhancements & Architectural Changes

1. Authoritative Format and DPI Persistence (core/history.js, extensions/system-patches.js, io/file-io.js)

  • serializeCurrentPage() now explicitly captures and persists format and dpi on every page object:
  • page.format: the authoritative paper format string (e.g., 'A4', 'Letter', 'A3').
  • page.dpi: the active rendering resolution (e.g., 300, 150, 96).
  • Both window.saveDocument() in extensions/system-patches.js and saveDocument() in io/file-io.js now enforce that:
  • The root document data contains docData.format and docData.dpi.
  • Every page in docData.pages carries explicit format and dpi properties.
  • Active margins and marginsDpi are proportionally scaled and saved.

2. Physical Unit Conversion & Dynamic Format Detection (core/units.js)

  • Corrected millimeter physical unit conversion in UnitConversionService:
  • mm: (num / 25.4) * dpi (fixed the 2.54 conversion error).
  • Enhanced UnitConversionService.detectFormat(w, h, dpi):
  • Dynamically calculates preset tolerance based on resolution: const tolerance = Math.max(16, d * 0.08).
  • Prioritizes the active document DPI at the front of the candidate DPI search array ([d, 96, 72, 140, 150, 300]).
  • Added robust aspect-ratio and dimension fallback checks for standard paper formats (Letter, A4, A5, Square) when dimensions approximate canonical ratios.

3. File Loader Synchronization (io/publisher-file-loader.js, io/file-io.js)

  • Reconnected the #file-open change listener in io/file-io.js to ensure native .opub, .json, .pub, and .docx files trigger appropriate loading pipelines reliably.
  • In io/publisher-file-loader.js:
  • Extracts docData.format directly from the file or derives it using the active DPI.
  • Ensures every loaded page record retains format and dpi.
  • Immediately invokes window.updateDpiDisplay(state.dpi) and window.setPageFormatIcon(state.format) upon document load.

4. Interactive "Change Size" Dialog Improvements (layout/document.js)

  • When opening the "Change Size" modal dialog:
  • The DPI dropdown automatically pre-selects the document's active DPI (e.g., 300 DPI).
  • The active preset format button (e.g., A4 or Letter) is highlighted with active teal styling (.resize-preset-btn.active).
  • Changing the DPI dropdown automatically recalculates and displays updated pixel dimensions while preserving the selected unit.
  • Clicking a preset format updates input dimensions, active button highlights, and sets state.format.
  • Confirming the dialog updates state.format, state.dpi, and propagates both values across all pages in state.pages.

5. Multi-Page Format & DPI Inheritance (core/pages.js)

  • In addNewPage():
  • Newly created pages automatically inherit format and dpi from the currently active page.
  • Preserves resolution and paper geometry across multi-page publications.
  • In createNewDocument(format, orientation):
  • Sets explicit state.format and newPage.format.
  • In renderPage(pageData):
  • Prioritizes pageData.format || state.format when updating the format indicator.
  • Calls window.updateDpiDisplay(pageDpi) on each page switch.

6. Dashboard Recent Documents Full State Restoration (ui/dashboard.js)

  • Restores full document state when loading from recent cards:
  • state.dpi = fileData.dpi || (fileData.pages && fileData.pages[0].dpi) || 96.
  • state.format = fileData.format || (fileData.pages && fileData.pages[0].format) || file.pageSize.
  • Restores unit, rulerUnit, margins, marginsDpi, isSpreadMode, and ruler origins.
  • Immediately synchronizes window.updateDpiDisplay and window.setPageFormatIcon.
  • Enhanced addToRecent() to accept either full document objects or individual parameters, automatically preserving explicit format labels.

7. Asset & Script Cachebuster Bump (index.html)

  • All local script references, stylesheets, and startup assets in index.html have been bumped to ?v=5.1.6 to guarantee browsers load the latest updates without caching stale files.

🧪 Verification & Automated Testing

Automated verification tests were conducted via Playwright (scratch/test_dpi_v516_verification.py):

  1. A4 @ 300 DPI Save and Reload:
  2. Configured document as A4 at 300 DPI.
  3. Saved publication to .opub.
  4. Reloaded document via #file-open input.
  5. Result: Format indicator verified as A4, status bar verified as 300 DPI, and "Change Size" dialog verified with 300 DPI and A4 preset active.
  6. Letter @ 300 DPI Save and Reload:
  7. Configured document as Letter at 300 DPI.
  8. Saved and reloaded.
  9. Result: Format indicator verified as Letter, status bar verified as 300 DPI.
  10. Multi-Page Format & DPI Inheritance:
  11. Added Page 2 to a 300 DPI Letter document.
  12. Result: Page 2 inherited Letter format and 300 DPI; status bar and badges remained synchronized.
  13. Dashboard Recent Files Restoration:
  14. Saved a high-DPI document to recent history.
  15. Opened Dashboard and launched the recent document card.
  16. Result: Full state restored, format badge showed A4, and status bar showed 300 DPI.

✅ Checklist Completed

  • [x] core/units.js: Fixed physical millimeter unit conversion in toPixels ((num / 25.4) * dpi); dynamically scaled preset detection tolerance based on resolution (Math.max(16, d * 0.08)); prioritized active document DPI in search candidates; overhauled aspect-ratio and dimension fallback checks for standard paper formats (Letter, A4, A5, Square).
  • [x] core/history.js: Updated serializeCurrentPage() to capture and persist explicit format and dpi properties on each page snapshot.
  • [x] layout/document.js: Updated setPageSize() to set state.format = format and page.format = format; enhanced changeSize() to pre-select active document DPI, highlight active preset button with teal styling, dynamically recalculate pixel dimensions upon DPI selection change, track user-chosen preset formats, and authoritatively propagate format and DPI updates across all pages upon confirmation.
  • [x] core/pages.js: Enhanced renderPage() to prioritize pageData.format || state.format when setting format indicator and invoke window.updateDpiDisplay(pageDpi); updated addNewPage() to inherit dpi and format from current page; updated createNewDocument() to set explicit state.format and newPage.format.
  • [x] extensions/system-patches.js: Enhanced saveDocument() to ensure all pages carry explicit format and dpi, store docData.format and docData.dpi at document root, and synchronize with DashboardSystem.addToRecent().
  • [x] io/file-io.js: Updated legacy saveDocument() to serialize docData.format and page.format; reconnected #file-open change event listener to reliably handle .opub, .json, .pub, and .docx file uploads.
  • [x] io/publisher-file-loader.js: Updated loadDocumentData() to extract docData.format, guarantee all loaded pages have format and dpi, and immediately invoke window.updateDpiDisplay(state.dpi) and window.setPageFormatIcon(state.format).
  • [x] ui/dashboard.js: Added open() alias; updated recent file card click handler to restore full document state including state.dpi, state.format, state.unit, state.margins, and state.marginsDpi; immediately synchronized DPI display and format badges; enhanced addToRecent() to accept both object and parameter signatures and preserve explicit format labels.
  • [x] elements/templates/templates.js & extensions/ui-interactions.js: Updated getPageSizeLabel() with dynamic tolerance; fixed loadTemplate() in both files to properly extract dimensions and retain preset format and DPI.
  • [x] index.html: Bumped all local script tags, stylesheets, and startup assets to ?v=5.1.6.

🎉 Version 5.1.6 - Open Publisher

Source: README.md, updated 2026-09-26