| Name | Modified | Size | Downloads / 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:
- Absence of Explicit Format Property in Saved Document Schemas:
- Neither
state.formatnorpage.formatwas serialized in.opub/.jsonpublication files or history page snapshots. - When loading, the application attempted to reverse-engineer the paper format solely by matching pixel dimensions (
paper.style.widthandheight) against predefined presets at default 96 DPI. -
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".
-
DPI Loss in Dashboard Recent Files Restoration:
- In
ui/dashboard.js, clicking a recent publication card previously restored pages, history, and metadata but completely omittedstate.dpi. -
Consequently,
state.dpiremained stuck at the global default of 96, immediately breaking resolution-dependent layout calculations and displaying "96 DPI" on the status bar. -
Missing UI Badge & Indicator Synchronization in File Loaders:
io/publisher-file-loader.jssuccessfully parsed publication files but omitted invokingwindow.updateDpiDisplay(state.dpi)andwindow.setPageFormatIcon(state.format).-
As a result, the top-right format badge and status bar DPI display remained un-synchronized until the user manually manipulated canvas controls.
-
Arithmetic Bug in Millimeter Physical Unit Conversion:
- In
core/units.js, converting millimeters to inches inUnitConversionService.toPixelserroneously divided by2.54instead of25.4(confusing centimeters with millimeters). -
This caused millimeter-based format checks to fail by an order of magnitude.
-
Fixed Pixel Tolerance in Format Detection:
UnitConversionService.detectFormat(w, h, dpi)used a static tolerance of 2 pixels (Math.abs(w - pw) <= 2).-
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.
-
Template Loading Format Collisions:
- In
extensions/ui-interactions.jsandelements/templates/templates.js, the template loading handler inspectedt.wwhich was undefined on native.opubobjects, defaultingfmt = '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 persistsformatanddpion 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()inextensions/system-patches.jsandsaveDocument()inio/file-io.jsnow enforce that: - The root document data contains
docData.formatanddocData.dpi. - Every page in
docData.pagescarries explicitformatanddpiproperties. - Active margins and
marginsDpiare 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 the2.54conversion 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-openchange listener inio/file-io.jsto ensure native.opub,.json,.pub, and.docxfiles trigger appropriate loading pipelines reliably. - In
io/publisher-file-loader.js: - Extracts
docData.formatdirectly from the file or derives it using the active DPI. - Ensures every loaded page record retains
formatanddpi. - Immediately invokes
window.updateDpiDisplay(state.dpi)andwindow.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 instate.pages.
5. Multi-Page Format & DPI Inheritance (core/pages.js)
- In
addNewPage(): - Newly created pages automatically inherit
formatanddpifrom the currently active page. - Preserves resolution and paper geometry across multi-page publications.
- In
createNewDocument(format, orientation): - Sets explicit
state.formatandnewPage.format. - In
renderPage(pageData): - Prioritizes
pageData.format || state.formatwhen 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.updateDpiDisplayandwindow.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.htmlhave been bumped to?v=5.1.6to 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):
- A4 @ 300 DPI Save and Reload:
- Configured document as A4 at 300 DPI.
- Saved publication to
.opub. - Reloaded document via
#file-openinput. - Result: Format indicator verified as
A4, status bar verified as300 DPI, and "Change Size" dialog verified with300DPI andA4preset active. - Letter @ 300 DPI Save and Reload:
- Configured document as Letter at 300 DPI.
- Saved and reloaded.
- Result: Format indicator verified as
Letter, status bar verified as300 DPI. - Multi-Page Format & DPI Inheritance:
- Added Page 2 to a 300 DPI Letter document.
- Result: Page 2 inherited
Letterformat and300DPI; status bar and badges remained synchronized. - Dashboard Recent Files Restoration:
- Saved a high-DPI document to recent history.
- Opened Dashboard and launched the recent document card.
- Result: Full state restored, format badge showed
A4, and status bar showed300 DPI.
✅ Checklist Completed
- [x]
core/units.js: Fixed physical millimeter unit conversion intoPixels((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: UpdatedserializeCurrentPage()to capture and persist explicitformatanddpiproperties on each page snapshot. - [x]
layout/document.js: UpdatedsetPageSize()to setstate.format = formatandpage.format = format; enhancedchangeSize()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: EnhancedrenderPage()to prioritizepageData.format || state.formatwhen setting format indicator and invokewindow.updateDpiDisplay(pageDpi); updatedaddNewPage()to inheritdpiandformatfrom current page; updatedcreateNewDocument()to set explicitstate.formatandnewPage.format. - [x]
extensions/system-patches.js: EnhancedsaveDocument()to ensure all pages carry explicitformatanddpi, storedocData.formatanddocData.dpiat document root, and synchronize withDashboardSystem.addToRecent(). - [x]
io/file-io.js: Updated legacysaveDocument()to serializedocData.formatandpage.format; reconnected#file-openchange event listener to reliably handle.opub,.json,.pub, and.docxfile uploads. - [x]
io/publisher-file-loader.js: UpdatedloadDocumentData()to extractdocData.format, guarantee all loaded pages haveformatanddpi, and immediately invokewindow.updateDpiDisplay(state.dpi)andwindow.setPageFormatIcon(state.format). - [x]
ui/dashboard.js: Addedopen()alias; updated recent file card click handler to restore full document state includingstate.dpi,state.format,state.unit,state.margins, andstate.marginsDpi; immediately synchronized DPI display and format badges; enhancedaddToRecent()to accept both object and parameter signatures and preserve explicit format labels. - [x]
elements/templates/templates.js&extensions/ui-interactions.js: UpdatedgetPageSizeLabel()with dynamic tolerance; fixedloadTemplate()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