Repository navigation
Description
Problem
(origin/main 1c61fa6.) LayoutImageRenderer writes /Alt (Figure) for an image that has no alt text:
// src/VellumPdf.Layout/Rendering/LayoutImageRenderer.cs
161: var elem = new PdfStructElem("Figure")
163: Mcid = mcid,
164: AltText = _img.AltText ?? "Figure",The behaviour is documented (src/VellumPdf.Layout/Elements/LayoutImage.cs:139-145: "If null, a generic fallback
"Figure" is used"). LayoutImage has no Decorative property. A search of src/VellumPdf.Layout for
Decorative finds it only on PieChart (Elements/PieChart.cs:268), where PieChartRenderer.cs:192-193 draws a
decorative chart inside BeginArtifactMarkedContent(). So a decorative image cannot be an artifact, and an
image without alt text gets a placeholder that validators accept.
Measured
Measured in the 2026-11-16 handbook research on VellumPdf 2.3.3 (not reproduced for this issue): the image
without alt text came out as Figure mcid=38 Alt='Figure', and both veraPDF ua1 and the preflight passed,
because ISO 14289-1 7.3 is checked only as "a non-empty /Alt". In a Dutch document the English word is also
in the wrong language (7.2).
Why it matters
ISO 14289-1 7.3: alternative text must represent the content, and graphics that carry no meaning must be
artifacts. A placeholder satisfies the machine check and tells a screen-reader user nothing.
Scope (v2.4: report; refused only in strict mode, which is opt-in)
- Add
LayoutImage.Decorative. A decorative image is drawn inside an artifact and creates noFigure. Setting
bothDecorativeand a non-nullAltTextis refused at save (a new property, so this is not a Refuse the input 2.3.x only reports: the contract changes a patch cannot make #484 tightening
of existing behaviour). - A tagged image with no
AltTextand notDecorativeis reported through the diagnostics channel (Layout: one general diagnostics channel and an opt-in strict mode (the additive half of #496 and the channel of #304) #607),
naming the image. Strict mode throws. Default keeps writing today's bytes,/Alt (Figure), so a document that
saves today still saves, and the report is what tells the caller. Whether the default should instead omit the
placeholder is an open question for the design review, because omitting it changes bytes and fails 7.3. - The artifact for a decorative image carries
/Type /Layout(Kernel: marked-content sequences cannot carry a property list, so artifacts have no Type, Subtype or BBox #605). - Precedent and difference:
PieChart.Decorativealready draws an artifact andPieChart.AltTextis ignored when
Decorativeis true (PieChart.cs:250-254).LayoutImage.Decorativeis a new property, so there is no caller to
keep compatible, and refusing the combination at save tells the caller about a contradiction that ignoring would
hide. The brief may instead follow the pie chart's ignore rule; it must state which and why. - Alt text in another language: reuse the element language (Layout: no language change inside a paragraph, heading or list item #584) rather than a new property.
Acceptance
- A tagged image with neither alt text nor
Decorativeyields one report naming the image; strict mode throws
InvalidOperationException. - A decorative image produces no
Figureelement and its content sits inside an artifact (assert on the
structure tree and the content stream). Decorative = truewithAltText = "x"is refused at save with a message naming both properties.- An image with alt text is unchanged (golden test).
- The test fails on origin/main 1c61fa6, proven by mutation.
Relates to
- Layout: build-time accessibility diagnostics, with a strict mode #304 (build-time diagnostics), Layout: the full PDF/UA-2 element set, with Alt, ActualText, Lang and Ref #293, Kernel: extend PdfStructElem — /NS, /Ref, /ActualText, /ID and attribute objects #272, Refuse the input 2.3.x only reports: the contract changes a patch cannot make #484, Layout: one general diagnostics channel and an opt-in strict mode (the additive half of #496 and the channel of #304) #607, Kernel: marked-content sequences cannot carry a property list, so artifacts have no Type, Subtype or BBox #605.
Activity
test: pin graphics and image output to its ISO clauses (#765)