Browse Source

Fixed layout rendering

Marcin Ziąbek 4 years ago
parent
commit
ae7873680d
2 changed files with 8 additions and 3 deletions
  1. 1 1
      QuestPDF/Drawing/DocumentGenerator.cs
  2. 7 2
      QuestPDF/Fluent/TextExtensions.cs

+ 1 - 1
QuestPDF/Drawing/DocumentGenerator.cs

@@ -77,7 +77,7 @@ namespace QuestPDF.Drawing
                 if (currentPage >= documentMetadata.DocumentLayoutExceptionThreshold)
                 if (currentPage >= documentMetadata.DocumentLayoutExceptionThreshold)
                 {
                 {
                     canvas.EndDocument();
                     canvas.EndDocument();
-                    ThrowLayoutException();
+                    throw new DocumentLayoutException("Composed layout generates infinite document.");
                 }
                 }
                 
                 
                 if (spacePlan is FullRender)
                 if (spacePlan is FullRender)

+ 7 - 2
QuestPDF/Fluent/TextExtensions.cs

@@ -53,7 +53,7 @@ namespace QuestPDF.Fluent
             style ??= DefaultStyle;
             style ??= DefaultStyle;
  
  
             var items = text
             var items = text
-                .Split(new[] { Environment.NewLine }, StringSplitOptions.None)
+                .Split(new[] { '\n' }, StringSplitOptions.None)
                 .Select(x => new TextBlockSpan
                 .Select(x => new TextBlockSpan
                 {
                 {
                     Text = x,
                     Text = x,
@@ -73,7 +73,12 @@ namespace QuestPDF.Fluent
                 .ForEach(TextBlocks.Add);
                 .ForEach(TextBlocks.Add);
         }
         }
 
 
-        public void NewLine()
+        public void Line(string text)
+        {
+            Span(Environment.NewLine + text);
+        }
+        
+        public void EmptyLine()
         {
         {
             Span(Environment.NewLine);
             Span(Environment.NewLine);
         }
         }