Skip to content

Fix hermes_privat_v112 crop to match the v1.1.2 layout - #23

Open
MaxWinterstein wants to merge 1 commit into
typingbeaver:masterfrom
MaxWinterstein:fix-hermes-privat-v112-crop
Open

Fix hermes_privat_v112 crop to match the v1.1.2 layout#23
MaxWinterstein wants to merge 1 commit into
typingbeaver:masterfrom
MaxWinterstein:fix-hermes-privat-v112-crop

Conversation

@MaxWinterstein

Copy link
Copy Markdown

hermes-privat-v112 was created in 85dec85 by renaming hermesPrivatV111; no coordinate was changed. Measured against a real v1.1.2 label, several source rectangles miss content:

element rectangle in code actual ink missing
Titel y 180–224 y 165–205 15 px at the top
Empfänger Land y 1212–1242 y 1217–1244 2 px at the bottom
Zahlungscode x 250–1005 x 260–1010 5 px at the right ("bezahlt")
Sendungsnummer x 306–606 x 260–602 46 px of bar length

The title was also drawn at dst y = 0 and the divider ran from y 0 to y 696, flush with the canvas edge instead of inside the 12 px (1 mm) zone crop.js marks in debug mode.

Resulting ink in the 1642×696 output canvas:

before after
Titel y 0..25 (26 px of 41 px visible) y 15..55
Zahlungscode x ..1639 x ..1637, "bezahlt" complete
Sendungsnummer y 380..675 (296 px) y 338..679 (342 px)
all elements y 0..695 y 12..683

before and after

Also included: the first sample for this label version (samples/hermes/hermes_privat.png / .pdf, generated with the app itself) and the two README links enabled. The previous sample image still showed the old v1.0.2 "Privatservice" layout, which is probably why it was commented out.

Gewichtswarnung and Zusatz EU are left untouched — my label does not contain them, so I could not measure them.

How the numbers were measured: the page was rendered with the app's own pdf.js at scale 4, every drawImage call recorded through a Proxy on the 2D context, and the real ink bounding boxes measured instead of eyeballing coordinates. The label's fonts are embedded, so the values do not depend on the renderer.

The anonymised label I measured against sits on a side branch of my fork, in case you want to re-check: addresses, both shipment IDs, barcode, both QR codes and the tracking link annotation are replaced, and it still reproduces the clipping.

Prepared with AI assistance (Claude Code) — analysis, measurements and patch come from an agent session.

The v1.1.2 bump only renamed the entry, so the rectangles still described
the v1.1.1 label. Measured against a real v1.1.2 label, the title crop
missed the top 15px of the glyphs, `Zahlungscode` cut 5px off "bezahlt",
`Empfänger Land` cut 2px, and the `Sendungsnummer` barcode lost 46px of
bar length. Title and divider were also drawn flush to the canvas edge
instead of inside the 12px safety zone used elsewhere.

Also adds the first sample for this label version and enables its README
links; the previous sample image still showed the old v1.0.2 layout.
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.

1 participant