Skip to content

Layout: a missing alt text is replaced by the English word Figure, and images have no decorative option #583

Open

Description

@Tim81

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)

Acceptance

  • A tagged image with neither alt text nor Decorative yields one report naming the image; strict mode throws
    InvalidOperationException.
  • A decorative image produces no Figure element and its content sits inside an artifact (assert on the
    structure tree and the content stream).
  • Decorative = true with AltText = "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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/conformancearea/layoutbug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions