Chapter 9. Tray & Print Preview

wxprint Last Updated: 2026-10-25 10:52 Views: 35

Chapter 9. Tray & Print Preview

9.1 The tray program

wxprint-tray is the desktop default form: it resides in the system tray (notification area), starts with the session, and brings up the embedded print service. The tray tooltip shows the running state and listen address.

Context menu:

Item Behavior
WxPrint (first item, read-only) Product name
Settings Opens the settings dialog (Section 9.2)
Pause service / Resume service Stop accepting new jobs (in-flight jobs finish) / resume
Start at login (checked state) Toggle autostart registration (Windows Run key / macOS LaunchAgent / Linux XDG autostart)
Switch language A submenu listing 21 languages with a ✓ on the current one; switching applies immediately (menu and dialogs re-render)
Check for updates Manual check (see Section 9.4)
About WxPrint About dialog
Quit Stops the service and the tray

9.2 Settings dialog

“Settings” opens a standalone window with a left navigation tree of three pages and forms on the right (saving writes to ~/.wxprint/config.json):

  • Network: listen address and port (bind); an enable http/ws toggle; enable https/wss (TLS port, certificate type — self-signed (fill in the domain, generated automatically on save) or specified (pick the certificate and private-key files)). Listen address and TLS changes take effect after a service restart (the dialog says so).
  • Security: access token (empty = no authentication; a “generate random” button produces a strong value); allow private-network URLs (loadURL data sources); allow arbitrary local data files (loadJSON path, restricted to ~/.wxprint/data/ by default).
  • Behavior: start at login; UI theme (dark/light); log level.

The settings dialog re-reads the on-disk configuration every time it opens — edits made elsewhere (tray, hand-edited file, service) never silently overwrite each other. RTL languages such as Arabic mirror the dialog and form layout automatically (the left navigation moves to the right).

9.3 The native print preview window

When a preview job (WS type:"preview" / REST preview: true) completes, the tray pops the native preview window — one window per preview job. It is the vehicle of the “preview first, commit after” flow.

The window is frameless with a custom-drawn chrome (following the app’s dark/light theme, unaffected by the system title-bar color):

  • Title bar (38px): “Language / Theme” buttons plus an ℹ about button on the left, the centered title “Print Preview - WxPrint”, and minimize/maximize/close on the right; drag to move, double-click to maximize.
  • Edge resizing: the cursor at a window edge turns into a resize cursor — drag to resize (disabled while maximized); the minimum window width is 800px.

Window structure:

  • Top toolbar: paging (previous/next), page indicator, render warnings (e.g. unresolved variables), zoom ± (25% grid steps), and fit (to window width). The percentage in the middle is editable (press Enter to apply).
  • Viewport: a dark viewport with a millimeter ruler (26px, 5mm ticks); top-aligned mode (centered when the image is smaller than the viewport); drag to pan with clamping; re-rasterization beyond the source DPI keeps zoomed views sharp.
  • Bottom action bar: paper (presets A3/A4/A5/A6/B4/B5/Letter/ Legal plus the job’s original — switching re-renders at the new size), orientation (portrait/landscape, re-renders), printer (dropdown, system default when omitted), sharpness (rasterization DPI cap: 150/300/600/1200, 300 default — the 1:1 display semantics stay the same; the cap only decides where zooming beyond it switches to GPU scaling; pick 600⁄1200 for deep-zoom print inspection), a status line, Export PDF, Export PNG (all pages rasterized at 150 DPI and merged vertically into one tall image), and Print (server-side output, the same implementation as POST /api/jobs/{id}/print).

Export and print results are reported in inline message dialogs (shown for both completion and errors, with the status line kept in sync). “Print” inside the preview is server-side output — not the browser print dialog, with none of its forced headers, footers, or scaling.

9.4 Update check and about

  • Check for updates: triggered manually from the tray menu (the automatic check at startup can be disabled in settings). When an update exists it shows the current version, the latest version, and the changelog, then guides the download; otherwise it reports “already up to date”; network failures show an error.
  • About: shows the product name, version, and copyright.

9.5 Preview without the tray

When wxprint-server runs standalone (no tray), previews go through the server-side web component GET /preview/{job_id} (PNG paging + zoom + printer dropdown + print + save-as, see Section 4.12) — the same data, the same features.

← Previous Article Chapter 10. Integration Guide & Code Samples Next Article → Chapter 8. Print Designer

Comments

No comments yet