Browse Source

Code refactorization

Marcin Ziąbek 4 years ago
parent
commit
8c2250ecde
3 changed files with 8 additions and 8 deletions
  1. 1 1
      QuestPDF/Elements/Debug.cs
  2. 6 6
      QuestPDF/Elements/Page.cs
  3. 1 1
      QuestPDF/Elements/PageBreak.cs

+ 1 - 1
QuestPDF/Elements/Debug.cs

@@ -5,7 +5,7 @@ namespace QuestPDF.Elements
 {
 {
     internal class Debug : ContainerElement
     internal class Debug : ContainerElement
     {
     {
-        private static readonly TextStyle TextStyle = TextStyle.Default.Color("#FF0000").FontType("Consolas").Size(10);
+        private static readonly TextStyle TextStyle = TextStyle.Default.Color("#F00").FontType("Consolas").Size(10);
         
         
         internal override void Draw(ICanvas canvas, Size availableSpace)
         internal override void Draw(ICanvas canvas, Size availableSpace)
         {
         {

+ 6 - 6
QuestPDF/Elements/Page.cs

@@ -7,17 +7,17 @@ namespace QuestPDF.Elements
 {
 {
     internal class Page : IComponent
     internal class Page : IComponent
     {
     {
-        public Element? Header { get; set; }
-        public Element? Content { get; set; }
-        public Element? Footer { get; set; }
+        public Element Header { get; set; } = new Empty();
+        public Element Content { get; set; } = new Empty();
+        public Element Footer { get; set; } = new Empty();
 
 
         public void Compose(IContainer container)
         public void Compose(IContainer container)
         {
         {
             container.Section(section =>
             container.Section(section =>
             {
             {
-                section.Header().Element(Header ?? new Empty());
-                section.Content().Extend().Element(Content ?? new Empty());
-                section.Footer().Element(Footer ?? new Empty());
+                section.Header().Element(Header);
+                section.Content().Extend().Element(Content);
+                section.Footer().Element(Footer);
             });
             });
         }
         }
     }
     }

+ 1 - 1
QuestPDF/Elements/PageBreak.cs

@@ -12,7 +12,7 @@ namespace QuestPDF.Elements
             if (IsRendered)
             if (IsRendered)
                 return new FullRender(Size.Zero);
                 return new FullRender(Size.Zero);
             
             
-            return new PartialRender(availableSpace.Width, 1);
+            return new PartialRender(availableSpace.Width, availableSpace.Height);
         }
         }
 
 
         internal override void Draw(ICanvas canvas, Size availableSpace)
         internal override void Draw(ICanvas canvas, Size availableSpace)