diff --git a/Source/QuestPDF.Examples/InlinedExamples.cs b/Source/QuestPDF.Examples/InlinedExamples.cs index 8f4adda..8bdda8e 100644 --- a/Source/QuestPDF.Examples/InlinedExamples.cs +++ b/Source/QuestPDF.Examples/InlinedExamples.cs @@ -120,5 +120,42 @@ namespace QuestPDF.Examples .Background(Placeholders.BackgroundColor()); } } + + [Test] + public void RepeatingInlinedInHeader_Test() + { + RenderingTest + .Create() + .ProduceImages() + .ShowResults() + .RenderDocument(document => + { + document.Page(page => + { + page.Size(PageSizes.A4); + page.Margin(1, Unit.Inch); + page.PageColor(Colors.White); + + page.Header() + .Inlined(inlined => + { + inlined.Spacing(10); + + foreach (var i in Enumerable.Range(5, 5)) + inlined.Item().Width(i * 10).Height(20).Background(Colors.Red.Medium); + }); + + page.Content() + .PaddingVertical(20) + .Column(column => + { + column.Spacing(25); + + foreach (var i in Enumerable.Range(10, 20)) + column.Item().Width(i * 10).Height(50).Background(Colors.Grey.Lighten2); + }); + }); + }); + } } } \ No newline at end of file diff --git a/Source/QuestPDF/Elements/Inlined.cs b/Source/QuestPDF/Elements/Inlined.cs index dabab48..b32a4a4 100644 --- a/Source/QuestPDF/Elements/Inlined.cs +++ b/Source/QuestPDF/Elements/Inlined.cs @@ -102,6 +102,9 @@ namespace QuestPDF.Elements Canvas.Translate(new Position(0, -topOffset)); lines.SelectMany(x => x).ToList().ForEach(x => ChildrenQueue.Dequeue()); + + if (!ChildrenQueue.Any()) + ResetState(); void DrawLine(ICollection lineMeasurements) {