diff --git a/QuestPDF.Examples/ElementExamples.cs b/QuestPDF.Examples/ElementExamples.cs index 8cdd148..e1e7ae0 100644 --- a/QuestPDF.Examples/ElementExamples.cs +++ b/QuestPDF.Examples/ElementExamples.cs @@ -17,7 +17,7 @@ namespace QuestPDF.Examples .Placeholder(); } - [ShowResult] + //[ShowResult] [ImageSize(300, 300)] public void Section(IContainer container) { @@ -189,5 +189,27 @@ namespace QuestPDF.Examples grid.Element(8).Background("#DDD").Height(50); }); } + + [ShowResult] + [ImageSize(300, 300)] + public void Layers(IContainer container) + { + container + .Background("#FFF") + .Padding(25) + .Layers(layers => + { + layers.Layer().Text("Something else"); + + layers.PrimaryLayer().Stack(stack => + { + stack.Element().PaddingTop(20).Text("Dupa 1"); + stack.Element().PaddingTop(40).Text("Dupa 2"); + }); + + layers.Layer().Background("#8F00").Extend(); + layers.Layer().PaddingTop(40).Text("Super", TextStyle.Default.Size(24)); + }); + } } } \ No newline at end of file diff --git a/QuestPDF.Examples/Engine/ExampleTestBase.cs b/QuestPDF.Examples/Engine/ExampleTestBase.cs index 37cecb1..63fd1db 100644 --- a/QuestPDF.Examples/Engine/ExampleTestBase.cs +++ b/QuestPDF.Examples/Engine/ExampleTestBase.cs @@ -70,7 +70,7 @@ namespace QuestPDF.Examples.Engine } catch (Exception e) { - throw new Exception($"Cannot perform test ${fileName}", e); + throw new Exception($"Cannot perform test {fileName}", e); } if (showResult) @@ -86,7 +86,7 @@ namespace QuestPDF.Examples.Engine using var surface = SKSurface.Create(imageInfo); surface.Canvas.Scale(scalingFactor); - var canvas = new Canvas(surface.Canvas); + var canvas = new Drawing.Canvas(surface.Canvas); element?.Draw(canvas, size); surface.Canvas.Save(); diff --git a/QuestPDF.ReportSample/Layouts/Helpers.cs b/QuestPDF.ReportSample/Layouts/Helpers.cs index 2ad92a0..0604ed1 100644 --- a/QuestPDF.ReportSample/Layouts/Helpers.cs +++ b/QuestPDF.ReportSample/Layouts/Helpers.cs @@ -1,4 +1,5 @@ using System; +using System.Drawing; using QuestPDF.Fluent; using QuestPDF.Helpers; using QuestPDF.Infrastructure; @@ -7,22 +8,23 @@ namespace QuestPDF.ReportSample.Layouts { public static class Helpers { - static IContainer Cell(this IContainer container, string color) + static IContainer Cell(this IContainer container, bool background) { return container .Border(0.5f) - .Background(color) + .BorderColor(Colors.Grey.Lighten1) + .Background(background ? Colors.Grey.Lighten4 : Colors.White) .Padding(5); } - public static IContainer LightCell(this IContainer container) + public static IContainer ValueCell(this IContainer container) { - return container.Cell(Colors.Transparent); + return container.Cell(false); } - public static IContainer DarkCell(this IContainer container) + public static IContainer LabelCell(this IContainer container) { - return container.Cell(Colors.Grey.Lighten3); + return container.Cell(true); } public static string Format(this Location location) diff --git a/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs b/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs index 3e8f6f6..460f0b9 100644 --- a/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs @@ -1,4 +1,5 @@ using QuestPDF.Fluent; +using QuestPDF.Helpers; using QuestPDF.Infrastructure; namespace QuestPDF.ReportSample.Layouts @@ -29,13 +30,11 @@ namespace QuestPDF.ReportSample.Layouts container .Row(row => { - row.Spacing(5); - row.RelativeColumn(2).Component(new ImageTemplate(Model.PhotoData)); - row.RelativeColumn().Stack(stack => + row.RelativeColumn().PaddingLeft(5).Stack(stack => { - stack.Spacing(5); + stack.Spacing(7f); stack.Element().Component(new ImageTemplate(Model.MapDetailsSource)); stack.Element().Component(new ImageTemplate(Model.MapContextSource)); @@ -45,17 +44,17 @@ namespace QuestPDF.ReportSample.Layouts void PhotoDetails(IContainer container) { - container.Border(0.75f).Grid(grid => + container.Border(0.75f).BorderColor(Colors.Grey.Medium).Grid(grid => { grid.Columns(6); - grid.Element().DarkCell().Text("Date", Typography.Normal); - grid.Element(2).LightCell().Text(Model.Date?.ToString("g") ?? string.Empty, Typography.Normal); - grid.Element().DarkCell().Text("Location", Typography.Normal); - grid.Element(2).LightCell().Text(Model.Location.Format(), Typography.Normal); + grid.Element().LabelCell().Text("Date", Typography.Normal); + grid.Element(2).ValueCell().Text(Model.Date?.ToString("g") ?? string.Empty, Typography.Normal); + grid.Element().LabelCell().Text("Location", Typography.Normal); + grid.Element(2).ValueCell().Text(Model.Location.Format(), Typography.Normal); - grid.Element().DarkCell().Text("Comments", Typography.Normal); - grid.Element(5).LightCell().Text(Model.Comments, Typography.Normal); + grid.Element().LabelCell().Text("Comments", Typography.Normal); + grid.Element(5).ValueCell().Text(Model.Comments, Typography.Normal); }); } } diff --git a/QuestPDF.ReportSample/Layouts/SectionTemplate.cs b/QuestPDF.ReportSample/Layouts/SectionTemplate.cs index 8feb962..d18ef20 100644 --- a/QuestPDF.ReportSample/Layouts/SectionTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/SectionTemplate.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using QuestPDF.Fluent; +using QuestPDF.Helpers; using QuestPDF.Infrastructure; namespace QuestPDF.ReportSample.Layouts @@ -17,7 +18,7 @@ namespace QuestPDF.ReportSample.Layouts public void Compose(IContainer container) { container - .MinHeight(100) + .EnsureSpace() .Section(section => { section @@ -25,14 +26,14 @@ namespace QuestPDF.ReportSample.Layouts .PaddingBottom(5) .Text(Model.Title, Typography.Headline); - section.Content().Border(0.75f).Stack(stack => + section.Content().Border(0.75f).BorderColor(Colors.Grey.Medium).Stack(stack => { foreach (var part in Model.Parts) { stack.Element().Row(row => { - row.ConstantColumn(150).DarkCell().Text(part.Label, Typography.Normal); - var frame = row.RelativeColumn().LightCell(); + row.ConstantColumn(150).LabelCell().Text(part.Label, Typography.Normal); + var frame = row.RelativeColumn().ValueCell(); if (part is ReportSectionText text) frame.Text(text.Text, Typography.Normal); diff --git a/QuestPDF.ReportSample/Layouts/StandardReport.cs b/QuestPDF.ReportSample/Layouts/StandardReport.cs index c35f212..7f15d2c 100644 --- a/QuestPDF.ReportSample/Layouts/StandardReport.cs +++ b/QuestPDF.ReportSample/Layouts/StandardReport.cs @@ -28,7 +28,6 @@ namespace QuestPDF.ReportSample.Layouts container .PaddingVertical(40) .PaddingHorizontal(50) - .Page(page => { page.Header(ComposeHeader); @@ -43,16 +42,16 @@ namespace QuestPDF.ReportSample.Layouts { row.RelativeColumn().MaxWidth(300).Stack(stack => { - stack.Spacing(5); + stack.Spacing(10); stack .Element() .PaddingBottom(5) .Text(Model.Title, Typography.Title); - stack.Element().ShowOnce().Stack(table => + stack.Element().Stack(table => { - table.Spacing(5); + table.Spacing(2); foreach (var field in Model.HeaderFields) { diff --git a/QuestPDF.ReportSample/Typography.cs b/QuestPDF.ReportSample/Typography.cs index c0a32d3..c87a4f3 100644 --- a/QuestPDF.ReportSample/Typography.cs +++ b/QuestPDF.ReportSample/Typography.cs @@ -6,8 +6,8 @@ namespace QuestPDF.ReportSample { public static class Typography { - public static TextStyle Title => TextStyle.Default.FontType("Helvetica").Color(Colors.Black).Size(22).SemiBold(); - public static TextStyle Headline => TextStyle.Default.FontType("Helvetica").Color(Colors.Blue.Accent2).Size(14).SemiBold(); - public static TextStyle Normal => TextStyle.Default.FontType("Helvetica").Color(Colors.Black).Size(10).LineHeight(1.25f).AlignLeft(); + public static TextStyle Title => TextStyle.Default.FontType(Fonts.Calibri).Color(Colors.Black).Size(24).Black(); + public static TextStyle Headline => TextStyle.Default.FontType(Fonts.Calibri).Color(Colors.Blue.Medium).Size(16).SemiBold(); + public static TextStyle Normal => TextStyle.Default.FontType(Fonts.Calibri).Color(Colors.Black).Size(11).LineHeight(1.25f).AlignLeft(); } } \ No newline at end of file diff --git a/QuestPDF.UnitTests/EnsureSpaceTests.cs b/QuestPDF.UnitTests/EnsureSpaceTests.cs new file mode 100644 index 0000000..2dda190 --- /dev/null +++ b/QuestPDF.UnitTests/EnsureSpaceTests.cs @@ -0,0 +1,39 @@ +using NUnit.Framework; +using QuestPDF.Drawing.SpacePlan; +using QuestPDF.Elements; +using QuestPDF.Infrastructure; +using QuestPDF.UnitTests.TestEngine; + +namespace QuestPDF.UnitTests +{ + [TestFixture] + public class WrapWhenLittleSpaceTests + { + [Test] + public void Measure_ReturnsWrap_WhenNotEnoughSpace() + { + TestPlan + .For(x => new EnsureSpace + { + Child = x.CreateChild(), + MinHeight = 200 + }) + .MeasureElement(new Size(400, 100)) + .CheckMeasureResult(new Wrap()); + } + + [Test] + public void Measure_Continues_WhenEnoughSpace() + { + TestPlan + .For(x => new EnsureSpace + { + Child = x.CreateChild(), + MinHeight = 200 + }) + .MeasureElement(new Size(400, 300)) + .ExpectChildMeasure(new Size(400, 300), new FullRender(300, 250)) + .CheckMeasureResult(new FullRender(300, 250)); + } + } +} \ No newline at end of file diff --git a/QuestPDF.UnitTests/GridTests.cs b/QuestPDF.UnitTests/GridTests.cs new file mode 100644 index 0000000..09f0a59 --- /dev/null +++ b/QuestPDF.UnitTests/GridTests.cs @@ -0,0 +1,184 @@ +using System; +using FluentAssertions; +using FluentAssertions.Equivalency; +using NUnit.Framework; +using QuestPDF.Elements; +using QuestPDF.Fluent; +using QuestPDF.Infrastructure; +using QuestPDF.UnitTests.TestEngine; + +namespace QuestPDF.UnitTests +{ + [TestFixture] + public class GridTests + { + #region Alignment + + [Test] + public void AlignLeft() + { + // arrange + var structure = new Container(); + + var childA = TestPlan.CreateUniqueElement(); + var childB = TestPlan.CreateUniqueElement(); + var childC = TestPlan.CreateUniqueElement(); + var childD = TestPlan.CreateUniqueElement(); + var childE = TestPlan.CreateUniqueElement(); + + // act + structure + .Grid(grid => + { + grid.AlignLeft(); + + grid.Element(6).Element(childA); + grid.Element(4).Element(childB); + grid.Element(4).Element(childC); + grid.Element(2).Element(childD); + grid.Element(8).Element(childE); + }); + + // assert + var expected = new Container(); + + expected.Stack(stack => + { + stack.Element().Row(row => + { + row.RelativeColumn(6).Element(childA); + row.RelativeColumn(4).Element(childB); + row.RelativeColumn(2).Element(new Empty()); + }); + + stack.Element().Row(row => + { + row.RelativeColumn(4).Element(childC); + row.RelativeColumn(2).Element(childD); + row.RelativeColumn(6).Element(new Empty()); + }); + + stack.Element().Row(row => + { + row.RelativeColumn(8).Element(childE); + row.RelativeColumn(4).Element(new Empty()); + }); + }); + + structure.Child.Should().BeEquivalentTo(expected, o => o.WithStrictOrdering().IncludingAllRuntimeProperties()); + } + + [Test] + public void AlignCenter() + { + // arrange + var structure = new Container(); + + var childA = TestPlan.CreateUniqueElement(); + var childB = TestPlan.CreateUniqueElement(); + var childC = TestPlan.CreateUniqueElement(); + var childD = TestPlan.CreateUniqueElement(); + var childE = TestPlan.CreateUniqueElement(); + + // act + structure + .Grid(grid => + { + grid.AlignCenter(); + + grid.Element(6).Element(childA); + grid.Element(4).Element(childB); + grid.Element(4).Element(childC); + grid.Element(2).Element(childD); + grid.Element(8).Element(childE); + }); + + // assert + var expected = new Container(); + + expected.Stack(stack => + { + stack.Element().Row(row => + { + row.RelativeColumn(1).Element(new Empty()); + row.RelativeColumn(6).Element(childA); + row.RelativeColumn(4).Element(childB); + row.RelativeColumn(1).Element(new Empty()); + }); + + stack.Element().Row(row => + { + row.RelativeColumn(3).Element(new Empty()); + row.RelativeColumn(4).Element(childC); + row.RelativeColumn(2).Element(childD); + row.RelativeColumn(3).Element(new Empty()); + }); + + stack.Element().Row(row => + { + row.RelativeColumn(2).Element(new Empty()); + row.RelativeColumn(8).Element(childE); + row.RelativeColumn(2).Element(new Empty()); + }); + }); + + structure.Child.Should().BeEquivalentTo(expected, o => o.WithStrictOrdering().IncludingAllRuntimeProperties()); + } + + [Test] + public void AlignRight() + { + // arrange + var structure = new Container(); + + var childA = TestPlan.CreateUniqueElement(); + var childB = TestPlan.CreateUniqueElement(); + var childC = TestPlan.CreateUniqueElement(); + var childD = TestPlan.CreateUniqueElement(); + var childE = TestPlan.CreateUniqueElement(); + + // act + structure + .Grid(grid => + { + grid.AlignRight(); + + grid.Element(6).Element(childA); + grid.Element(4).Element(childB); + grid.Element(4).Element(childC); + grid.Element(2).Element(childD); + grid.Element(8).Element(childE); + }); + + // assert + var expected = new Container(); + + expected.Container().Stack(stack => + { + stack.Element().Row(row => + { + row.RelativeColumn(2).Element(new Empty()); + row.RelativeColumn(6).Element(childA); + row.RelativeColumn(4).Element(childB); + }); + + stack.Element().Row(row => + { + row.RelativeColumn(6).Element(new Empty()); + row.RelativeColumn(4).Element(childC); + row.RelativeColumn(2).Element(childD); + }); + + stack.Element().Row(row => + { + row.RelativeColumn(4).Element(new Empty()); + row.RelativeColumn(8).Element(childE); + }); + }); + + structure.Child.Should().BeEquivalentTo(expected, o => o.WithStrictOrdering().IncludingAllRuntimeProperties()); + } + + #endregion + } +} \ No newline at end of file diff --git a/QuestPDF.UnitTests/StackTests.cs b/QuestPDF.UnitTests/StackTests.cs index 9cc384b..cd01a53 100644 --- a/QuestPDF.UnitTests/StackTests.cs +++ b/QuestPDF.UnitTests/StackTests.cs @@ -266,9 +266,7 @@ namespace QuestPDF.UnitTests } }; - var traceWriter = new StringBuilderTraceWriter(); structure.Child.Should().BeEquivalentTo(expected, o => o.WithStrictOrdering().IncludingAllRuntimeProperties()); - Console.WriteLine( traceWriter.ToString()); } #endregion diff --git a/QuestPDF/Drawing/Canvas.cs b/QuestPDF/Drawing/Canvas.cs index 7c54e36..4239730 100644 --- a/QuestPDF/Drawing/Canvas.cs +++ b/QuestPDF/Drawing/Canvas.cs @@ -5,7 +5,7 @@ namespace QuestPDF.Drawing { internal class Canvas : ICanvas { - private SKCanvas SkiaCanvas { get; } + internal SKCanvas SkiaCanvas { get; } public Canvas(SKCanvas skiaCanvas) { diff --git a/QuestPDF/Elements/Canvas.cs b/QuestPDF/Elements/Canvas.cs new file mode 100644 index 0000000..012ae4a --- /dev/null +++ b/QuestPDF/Elements/Canvas.cs @@ -0,0 +1,29 @@ +using System; +using QuestPDF.Drawing.SpacePlan; +using QuestPDF.Infrastructure; +using SkiaSharp; + +namespace QuestPDF.Elements +{ + public delegate void DrawOnCanvas(SKCanvas canvas, Size availableSpace); + + internal class Canvas : Element + { + public DrawOnCanvas Handler { get; set; } + + internal override ISpacePlan Measure(Size availableSpace) + { + return new FullRender(availableSpace); + } + + internal override void Draw(ICanvas canvas, Size availableSpace) + { + var skiaCanvas = (canvas as Drawing.Canvas)?.SkiaCanvas; + + if (Handler == null || skiaCanvas == null) + return; + + Handler.Invoke(skiaCanvas, availableSpace); + } + } +} \ No newline at end of file diff --git a/QuestPDF/Elements/EnsureSpace.cs b/QuestPDF/Elements/EnsureSpace.cs new file mode 100644 index 0000000..1f00fee --- /dev/null +++ b/QuestPDF/Elements/EnsureSpace.cs @@ -0,0 +1,19 @@ +using QuestPDF.Drawing.SpacePlan; +using QuestPDF.Infrastructure; + +namespace QuestPDF.Elements +{ + internal class EnsureSpace : ContainerElement + { + public const float DefaultMinHeight = 150; + public float MinHeight { get; set; } = DefaultMinHeight; + + internal override ISpacePlan Measure(Size availableSpace) + { + if (availableSpace.Height < MinHeight) + return new Wrap(); + + return base.Measure(availableSpace); + } + } +} \ No newline at end of file diff --git a/QuestPDF/Elements/Layers.cs b/QuestPDF/Elements/Layers.cs new file mode 100644 index 0000000..23ab06a --- /dev/null +++ b/QuestPDF/Elements/Layers.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Linq; +using QuestPDF.Drawing.SpacePlan; +using QuestPDF.Infrastructure; + +namespace QuestPDF.Elements +{ + internal class Layer : ContainerElement + { + public bool IsPrimary { get; set; } + } + + internal class Layers : Element + { + public List Children { get; set; } = new List(); + + internal override ISpacePlan Measure(Size availableSpace) + { + return Children + .Single(x => x.IsPrimary) + .Measure(availableSpace); + } + + internal override void Draw(ICanvas canvas, Size availableSpace) + { + Children + .Where(x => x.Measure(availableSpace) is Size) + .ToList() + .ForEach(x => x.Draw(canvas, availableSpace)); + } + } +} \ No newline at end of file diff --git a/QuestPDF/Elements/Padding.cs b/QuestPDF/Elements/Padding.cs index db9b6eb..4c0f220 100644 --- a/QuestPDF/Elements/Padding.cs +++ b/QuestPDF/Elements/Padding.cs @@ -18,7 +18,7 @@ namespace QuestPDF.Elements var internalSpace = InternalSpace(availableSpace); - if (internalSpace.Width <= 0 || internalSpace.Height <= 0) + if (internalSpace.Width < 0 || internalSpace.Height < 0) return new Wrap(); var measure = Child.Measure(internalSpace) as Size; diff --git a/QuestPDF/Fluent/ComponentExtentions.cs b/QuestPDF/Fluent/ComponentExtentions.cs index fe57ea1..de161ea 100644 --- a/QuestPDF/Fluent/ComponentExtentions.cs +++ b/QuestPDF/Fluent/ComponentExtentions.cs @@ -56,7 +56,7 @@ namespace QuestPDF.Fluent var descriptor = new ComponentDescriptor(component); handler?.Invoke(descriptor); - component.Compose(element.Container()); + component.Compose(element); } static void Component(this IContainer element, Action>? handler = null) where T : IComponent, new() diff --git a/QuestPDF/Fluent/ElementExtensions.cs b/QuestPDF/Fluent/ElementExtensions.cs index d78fba9..9754c76 100644 --- a/QuestPDF/Fluent/ElementExtensions.cs +++ b/QuestPDF/Fluent/ElementExtensions.cs @@ -36,12 +36,12 @@ namespace QuestPDF.Fluent public static void Element(this TParent parent, Action handler) where TParent : IContainer { - handler(parent.Container()); + handler(parent); } public static IContainer Element(this TParent parent, Func handler) where TParent : IContainer { - return handler(parent.Container()).Container(); + return handler(parent); } public static IContainer Debug(this IContainer parent) @@ -90,6 +90,14 @@ namespace QuestPDF.Fluent return element.Element(new ShowEntire()); } + public static IContainer EnsureSpace(this IContainer element, float minHeight = Elements.EnsureSpace.DefaultMinHeight) + { + return element.Element(new EnsureSpace + { + MinHeight = minHeight + }); + } + public static void Text(this IContainer element, object text, TextStyle? style = null) { text ??= string.Empty; @@ -146,5 +154,13 @@ namespace QuestPDF.Fluent { return condition ? element : new Container(); } + + public static void Canvas(this IContainer element, DrawOnCanvas handler) + { + element.Element(new Elements.Canvas + { + Handler = handler + }); + } } } \ No newline at end of file diff --git a/QuestPDF/Fluent/LayerExtensions.cs b/QuestPDF/Fluent/LayerExtensions.cs new file mode 100644 index 0000000..47d236c --- /dev/null +++ b/QuestPDF/Fluent/LayerExtensions.cs @@ -0,0 +1,54 @@ +using System; +using System.Linq; +using QuestPDF.Drawing.Exceptions; +using QuestPDF.Elements; +using QuestPDF.Infrastructure; + +namespace QuestPDF.Fluent +{ + public class LayersDescriptor + { + internal Layers Layers { get; } = new Layers(); + + private IContainer Layer(bool isPrimary) + { + var container = new Container(); + + var element = new Layer + { + IsPrimary = isPrimary, + Child = container + }; + + Layers.Children.Add(element); + return container; + } + + public IContainer Layer() => Layer(false); + public IContainer PrimaryLayer() => Layer(true); + + internal void Validate() + { + var primaryLayers = Layers.Children.Count(x => x.IsPrimary); + + if (primaryLayers == 0) + throw new DocumentComposeException("The Layers component needs to have exactly one primary layer. It has none."); + + if (primaryLayers != 1) + throw new DocumentComposeException($"The Layers component needs to have exactly one primary layer. It has {primaryLayers}."); + } + } + + public static class LayerExtensions + { + public static void Layers(this IContainer element, Action handler) + { + var descriptor = new LayersDescriptor(); + + handler(descriptor); + descriptor.Validate(); + + element.Element(descriptor.Layers); + } + } +} \ No newline at end of file diff --git a/QuestPDF/Helpers/Colors.cs b/QuestPDF/Helpers/Colors.cs index bf55ecb..97b7a65 100644 --- a/QuestPDF/Helpers/Colors.cs +++ b/QuestPDF/Helpers/Colors.cs @@ -5,7 +5,7 @@ public const string Black = "#000000"; public const string White = "#ffffff"; public const string Transparent = "#00000000"; - + public class Red { public const string Lighten5 = "#ffebee"; @@ -14,7 +14,7 @@ public const string Lighten2 = "#e57373"; public const string Lighten1 = "#ef5350"; - public const string Default = "#f44336"; + public const string Medium = "#f44336"; public const string Darken1 = "#e53935"; public const string Darken2 = "#d32f2f"; @@ -35,7 +35,7 @@ public const string Lighten2 = "#f06292"; public const string Lighten1 = "#ec407a"; - public const string Default = "#e91e63"; + public const string Medium = "#e91e63"; public const string Darken1 = "#d81b60"; public const string Darken2 = "#c2185b"; @@ -56,7 +56,7 @@ public const string Lighten2 = "#ba68c8"; public const string Lighten1 = "#ab47bc"; - public const string Default = "#9c27b0"; + public const string Medium = "#9c27b0"; public const string Darken1 = "#8e24aa"; public const string Darken2 = "#7b1fa2"; @@ -77,7 +77,7 @@ public const string Lighten2 = "#9575cd"; public const string Lighten1 = "#7e57c2"; - public const string Default = "#673ab7"; + public const string Medium = "#673ab7"; public const string Darken1 = "#5e35b1"; public const string Darken2 = "#512da8"; @@ -98,7 +98,7 @@ public const string Lighten2 = "#7986cb"; public const string Lighten1 = "#5c6bc0"; - public const string Default = "#3f51b5"; + public const string Medium = "#3f51b5"; public const string Darken1 = "#3949ab"; public const string Darken2 = "#303f9f"; @@ -119,7 +119,7 @@ public const string Lighten2 = "#64b5f6"; public const string Lighten1 = "#42a5f5"; - public const string Default = "#2196f3"; + public const string Medium = "#2196f3"; public const string Darken1 = "#1e88e5"; public const string Darken2 = "#1976d2"; @@ -140,7 +140,7 @@ public const string Lighten2 = "#4fc3f7"; public const string Lighten1 = "#29b6f6"; - public const string Default = "#03a9f4"; + public const string Medium = "#03a9f4"; public const string Darken1 = "#039be5"; public const string Darken2 = "#0288d1"; @@ -161,7 +161,7 @@ public const string Lighten2 = "#4dd0e1"; public const string Lighten1 = "#26c6da"; - public const string Default = "#00bcd4"; + public const string Medium = "#00bcd4"; public const string Darken1 = "#00acc1"; public const string Darken2 = "#0097a7"; @@ -182,7 +182,7 @@ public const string Lighten2 = "#4db6ac"; public const string Lighten1 = "#26a69a"; - public const string Default = "#009688"; + public const string Medium = "#009688"; public const string Darken1 = "#00897b"; public const string Darken2 = "#00796b"; @@ -203,7 +203,7 @@ public const string Lighten2 = "#81c784"; public const string Lighten1 = "#66bb6a"; - public const string Default = "#4caf50"; + public const string Medium = "#4caf50"; public const string Darken1 = "#43a047"; public const string Darken2 = "#388e3c"; @@ -224,7 +224,7 @@ public const string Lighten2 = "#aed581"; public const string Lighten1 = "#9ccc65"; - public const string Default = "#8bc34a"; + public const string Medium = "#8bc34a"; public const string Darken1 = "#7cb342"; public const string Darken2 = "#689f38"; @@ -245,7 +245,7 @@ public const string Lighten2 = "#dce775"; public const string Lighten1 = "#d4e157"; - public const string Default = "#cddc39"; + public const string Medium = "#cddc39"; public const string Darken1 = "#c0ca33"; public const string Darken2 = "#afb42b"; @@ -266,7 +266,7 @@ public const string Lighten2 = "#fff176"; public const string Lighten1 = "#ffee58"; - public const string Default = "#ffeb3b"; + public const string Medium = "#ffeb3b"; public const string Darken1 = "#fdd835"; public const string Darken2 = "#fbc02d"; @@ -287,7 +287,7 @@ public const string Lighten2 = "#ffd54f"; public const string Lighten1 = "#ffca28"; - public const string Default = "#ffc107"; + public const string Medium = "#ffc107"; public const string Darken1 = "#ffb300"; public const string Darken2 = "#ffa000"; @@ -308,7 +308,7 @@ public const string Lighten2 = "#ffb74d"; public const string Lighten1 = "#ffa726"; - public const string Default = "#ff9800"; + public const string Medium = "#ff9800"; public const string Darken1 = "#fb8c00"; public const string Darken2 = "#f57c00"; @@ -329,7 +329,7 @@ public const string Lighten2 = "#ff8a65"; public const string Lighten1 = "#ff7043"; - public const string Default = "#ff5722"; + public const string Medium = "#ff5722"; public const string Darken1 = "#f4511e"; public const string Darken2 = "#e64a19"; @@ -350,7 +350,7 @@ public const string Lighten2 = "#a1887f"; public const string Lighten1 = "#8d6e63"; - public const string Default = "#795548"; + public const string Medium = "#795548"; public const string Darken1 = "#6d4c41"; public const string Darken2 = "#5d4037"; @@ -366,7 +366,7 @@ public const string Lighten2 = "#e0e0e0"; public const string Lighten1 = "#bdbdbd"; - public const string Default = "#9e9e9e"; + public const string Medium = "#9e9e9e"; public const string Darken1 = "#757575"; public const string Darken2 = "#616161"; @@ -382,7 +382,7 @@ public const string Lighten2 = "#90a4ae"; public const string Lighten1 = "#78909c"; - public const string Default = "#607d8b"; + public const string Medium = "#607d8b"; public const string Darken1 = "#546e7a"; public const string Darken2 = "#455a64"; diff --git a/QuestPDF/Helpers/Fonts.cs b/QuestPDF/Helpers/Fonts.cs new file mode 100644 index 0000000..fa3b085 --- /dev/null +++ b/QuestPDF/Helpers/Fonts.cs @@ -0,0 +1,25 @@ +namespace QuestPDF.Helpers +{ + public class Fonts + { + public const string Arial = "Arial"; + public const string Calibri = "Calibri"; + public const string Cambria = "Cambria"; + public const string Candara = "Candara"; + public const string ComicSans = "Comic Sans MS"; + public const string Consolas = "Consolas"; + public const string Corbel = "Corbel"; + public const string Courier = "Courier"; + public const string CourierNew = "Courier New"; + public const string Georgia = "Georgia"; + public const string Impact = "Impact"; + public const string LucidaConsole = "Lucida Console"; + public const string SegoeSD = "Segoe SD"; + public const string SegoeUI = "Segoe UI"; + public const string Tahoma = "Tahoma"; + public const string TimesNewRoman = "Times New Roman"; + public const string TimesRoman = "Times Roman"; + public const string Trebuchet = "Trebuchet MS"; + public const string Verdana = "Verdana"; + } +} \ No newline at end of file diff --git a/QuestPDF/QuestPDF.csproj b/QuestPDF/QuestPDF.csproj index 6fa377a..0c2854e 100644 --- a/QuestPDF/QuestPDF.csproj +++ b/QuestPDF/QuestPDF.csproj @@ -4,9 +4,9 @@ MarcinZiabek CodeFlint QuestPDF - 2021.3.1 + 2021.5-alpha QuestPDF is an open-source, modern and battle-tested library that can help you with generating PDF documents by offering friendly, discoverable and predictable C# fluent API. - Generating images functionality, ShowIf element, fixed mutating TextStyle + New elements: Grid, Canvas, EnsureSpace, Layers. Predefined colors and fonts. 8 true Logo.png