Repository navigation
Closed
Labels
area/layouthigh-level document/layout engineenhancementNew feature or requesttype/featurenew capability
Description
Problem
The Kernel outline entry has an IsExpanded property, and the Layout path never sets it, so every Layout bookmark
is open. (origin/main 1c61fa6.)
src/VellumPdf.Kernel/Annotations/PdfOutlineEntry.cs:43:public bool IsExpanded { get; init; } = true;. Its
documentation (:36-41):falseshows the item collapsed with a negative/Count.- The writer honours it:
PdfDocument.cs:1887(var countValue = entry.IsExpanded ? visibleCount : -visibleCount;)
and:1938. src/VellumPdf.Layout/Core/DrawContext.cs:244-255:
247: _document.AddOutlineEntry(new PdfOutlineEntry
248: {
249: Title = title,
250: DestPage = _page,
251: DestLeft = 0,
252: DestTop = pdfY,
253: Level = level,
254: });HeadingRenderer.Drawcalls it with title, level and Y only (HeadingRenderer.cs:76).- A search of
srcforIsExpandedfinds it only inPdfOutlineEntry.cs,PdfDocument.csand the Kernel
PublicAPI.Shipped.txt(lines 488-489), none undersrc/VellumPdf.Layout. HeadinghasBookmarkTitle(Heading.cs:85) andLevel(:79) and nothing for expansion.
Why it matters
A 200-page handbook with several hundred bookmarks opens with every one expanded. Readers show chapters collapsed
by convention.
Scope
Heading.BookmarkExpanded(bool, defaulttrue, so today's output is unchanged).- A
DrawContext.AddOutlineEntryoverload that takes it. The existing three-argument method is a shipped member
and stays as it is. - The split heading of Layout: a heading that splits across pages gets its bookmark at the page top #464 uses the same value on its single entry.
- XML documentation: a collapsed entry with no children has a visible-descendant count of zero, so its sign is
not observable. The brief checks whatPdfDocumentwrites for that case and documents it.
Acceptance
- A level-0 heading with
BookmarkExpanded = falsefollowed by two level-1 headings writes the parent's/Count
as-2(read back with the Reader). - The default heading writes a positive count, byte-identical to today (golden test).
- A custom renderer calling the old three-argument method is unaffected (test).
- The test fails on origin/main 1c61fa6 (no such property), proven by mutation.
Relates to
- Layout: a heading that splits across pages gets its bookmark at the page top #464 (split heading bookmark).
Metadata
Metadata
Assignees
Labels
area/layouthigh-level document/layout engineenhancementNew feature or requesttype/featurenew capability
Activity
docs(layout): state the outline children rule as the writer applies it (