Fixed layout rendering
This commit is contained in:
@@ -55,8 +55,11 @@ namespace QuestPDF.Drawing
|
||||
pageContext.SetPageNumber(currentPage);
|
||||
var spacePlan = content.Measure(Size.Max) as Size;
|
||||
|
||||
if (spacePlan == null)
|
||||
break;
|
||||
if (spacePlan == null)
|
||||
{
|
||||
canvas.EndDocument();
|
||||
ThrowLayoutException();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -74,7 +77,7 @@ namespace QuestPDF.Drawing
|
||||
if (currentPage >= documentMetadata.DocumentLayoutExceptionThreshold)
|
||||
{
|
||||
canvas.EndDocument();
|
||||
throw new DocumentLayoutException("Composed layout generates infinite document.");
|
||||
ThrowLayoutException();
|
||||
}
|
||||
|
||||
if (spacePlan is FullRender)
|
||||
@@ -84,6 +87,11 @@ namespace QuestPDF.Drawing
|
||||
}
|
||||
|
||||
canvas.EndDocument();
|
||||
|
||||
void ThrowLayoutException()
|
||||
{
|
||||
throw new DocumentLayoutException("Composed layout generates infinite document.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace QuestPDF.Fluent
|
||||
style ??= DefaultStyle;
|
||||
|
||||
var items = text
|
||||
.Split(new[] { Environment.NewLine }, StringSplitOptions.None)
|
||||
.Split(new[] { '\n' }, StringSplitOptions.None)
|
||||
.Select(x => new TextBlockSpan
|
||||
{
|
||||
Text = x,
|
||||
@@ -73,7 +73,12 @@ namespace QuestPDF.Fluent
|
||||
.ForEach(TextBlocks.Add);
|
||||
}
|
||||
|
||||
public void NewLine()
|
||||
public void Line(string text)
|
||||
{
|
||||
Span(Environment.NewLine + text);
|
||||
}
|
||||
|
||||
public void EmptyLine()
|
||||
{
|
||||
Span(Environment.NewLine);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user