Skip to content

UX: remember last directory and zoom level; add support for jbig2/jpeg2000 to preview#434

Open
sam2kb wants to merge 2 commits into
intoolswetrust:masterfrom
sam2kb:pr-preview-ux
Open

UX: remember last directory and zoom level; add support for jbig2/jpeg2000 to preview#434
sam2kb wants to merge 2 commits into
intoolswetrust:masterfrom
sam2kb:pr-preview-ux

Conversation

@sam2kb

@sam2kb sam2kb commented Jun 27, 2026

Copy link
Copy Markdown
  • Remember chosen directory in File > Open across invocations, persisted to config.properties.
  • Remember zoom level across document loads, persisted to config.properties.
  • Add jbig2-imageio and jai-imageio-jpeg2000 dependencies so the PDF preview can render optimized/reduced-size PDFs.

Alex and others added 2 commits June 26, 2026 23:21
…review support

- Remember chosen directory in File > Open across invocations,
  persisted to config.properties.
- Remember zoom level across document loads, persisted to
  config.properties.
- Add jbig2-imageio and jai-imageio-jpeg2000 dependencies so the
  PDF preview can render optimized/reduced-size PDFs.
…essively

- Remove the jai-imageio-jpeg2000 dependency (and its enabler
  jai-imageio-core runtime dep). Its bundled JJ2000 codec is under a
  restrictive, GPL-incompatible license with a field-of-use clause and
  patent warning, and its license isn't in the add-third-party allow
  list, so it would break the release build's license check. Keep the
  clean Apache-2.0 jbig2-imageio for scanned (JBIG2) PDFs.
- jai-imageio-core reverts to dependencyManagement-only (convergence).
- Stop writing config.properties on every zoom change (blocking I/O on
  the FX thread); track zoom in memory and persist on document open/exit.
- Persist the last open directory from openDocument() so drag-drop and
  recent-files opens also remember it, not just File > Open.
- Log persistence failures at FINE instead of swallowing them; tidy
  imports and constant placement.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kwart

kwart commented Jul 5, 2026

Copy link
Copy Markdown
Member

Thanks for this @sam2kb! I pushed a follow-up commit (27c3779) with a few adjustments — quick summary of what changed and why:

Dropped jai-imageio-jpeg2000. The jbig2-imageio part is great and I kept it (Apache-2.0, and JBIG2 is common in scanned PDFs). But the JPEG2000 jar bundles the JJ2000 codec, which is under a restrictive license: it carries a patent warning, a field-of-use restriction ("no license for non JPEG 2000 conforming products"), and is explicitly GPL-incompatible. That is a poor fit for a project shipped under MPL-2.0 / LGPL-2.1. It would also have broken the release build in practice: the license-maven-plugin (add-third-party) allow-list only permits Apache-2.0/BSD/MIT/LGPL/MPL/BC, so a real (non-test) JJ2000 dependency trips failOnMissing/failOnBlacklist. JPEG2000 images in PDFs are rare, so the tradeoff didn't seem worth it. jai-imageio-core reverts to dependencyManagement-only (it was only there to feed the JPEG2000 codec / version convergence). JBIG2 licensing is picked up automatically by add-third-party, so no license-file changes are needed.

Persist view state less aggressively. The zoom listener was calling save() on every zoom change, i.e. synchronous disk I/O on the JavaFX thread per zoom step. I moved persistence to document-open and exit, keeping the zoom value in memory in between.

Persist last dir for all open paths. The last-directory save only happened on File > Open; drag-drop and recent-files went through openDocument() without persisting. Moved the save into openDocument() so all three paths remember the directory.

Minor: log persistence failures at FINE instead of swallowing exceptions, and tidied imports/constant placement.

The remember-directory and remember-zoom UX is a nice touch — thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants