You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3b840f0
Browse filesBrowse the repository at this point in the historyBrowse files
Cut PdfGenerator over to page-per-fragmentainer rendering (F1)
Replaces the old measure-once-then-scroll-offset-loop pagination
(while (scrollOffset > -container.ActualSize.Height) { AddPage();
scrollOffset -= pageSize.Height; PerformPaint(g); }) with
foreach (var fragmentainer in container.FragmentTree.Fragmentainers).
The fragment tree is now what actually drives real PDF output, not
just an internal structure nothing consumed yet - the first point in
this port where that's true.
Blank-page skipping (CSS Paged Media 3 3.2) falls out for free: a
content-empty page slot is never materialized as a fragmentainer (see
FragmentEmitter), so it's simply absent from this loop instead of
needing to be detected and special-cased.
HandleLinks no longer maps a link's document-Y to a page via a bare
pageSize.Height multiply/divide - slot indices aren't contiguous once
blank-page skipping is live. It now builds a slot-to-page-index map
from the materialized fragmentainers and tests each link's rectangle
against each fragmentainer's own Geometry band.
HtmlRenderer.PdfSharp gains InternalsVisibleTo access to the core
assembly (matching the existing WinForms/WPF grant) so it can reach
HtmlContainerInt.FragmentTree and the new PerformPaint(RGraphics,
FragmentainerFragment) overload - both stay internal rather than
becoming public API while this port is still underway.
Found and fixed a real bug in FragmentEmitter while wiring this up:
Finish() computed the last page slot from container.ActualSize.Height
as if it were an absolute document-Y coordinate, but ActualSize.Height
is document height *excluding* the root box's own top offset
(ActualSize.Height = ActualBottom - Root.Location.Y) - using it
directly double-subtracted MarginTop inside PageIndexOf and silently
under-reported the fragment tree's page count whenever content's true
bottom landed just past a boundary ActualSize.Height alone hadn't yet
crossed. This had been latent since D1/D2 (FragmentTree was structurally
present but never checked against real PDF page counts) and was only
caught here because F1 is the first place the fragment tree's own page
count actually has to be correct, not just non-empty.
New StageF1VerificationTest.cs: web/anchor links across pages don't
throw and produce link annotations, and a huge-margin document
produces no run of blank pages through the real pipeline. Full
existing suite (35 image-diff/fragment tests + 15 PDF/PdfSharp tests,
up from 13 now that the new pipeline exercises every prior stage's
page-count assertions for real) green.
0 commit comments