2021.12.0-alpha1

This commit is contained in:
Marcin Ziąbek
2021-11-30 00:34:04 +01:00
parent 77b8f04659
commit f2c47c4fd3
11 changed files with 54 additions and 31 deletions
+32 -9
View File
@@ -1,3 +1,4 @@
using System.Linq;
using NUnit.Framework;
using QuestPDF.Examples.Engine;
using QuestPDF.Fluent;
@@ -43,19 +44,41 @@ namespace QuestPDF.Examples
RenderingTest
.Create()
.PageSize(300, 300)
.PageSize(400, 600)
.ProduceImages()
.ShowResults()
.Render(container =>
{
container.Extend().Canvas((canvas, size) =>
{
var bar = new BarChart
container
.Background(Colors.White)
.Padding(25)
.Stack(stack =>
{
Entries = entries,
IsAnimated = false,
};
bar.Draw(canvas, (int)size.Width, (int)size.Height);
});
stack
.Item()
.PaddingBottom(10)
.Text("Chart example", TextStyle.Default.Size(20).SemiBold().Color(Colors.Blue.Medium));
stack
.Item()
.Border(1)
.ExtendHorizontal()
.Height(300)
.Canvas((canvas, size) =>
{
var chart = new BarChart
{
Entries = entries,
LabelOrientation = Orientation.Horizontal,
ValueLabelOrientation = Orientation.Horizontal,
IsAnimated = false,
};
chart.DrawContent(canvas, (int)size.Width, (int)size.Height);
});
});
});
}
}
+3 -4
View File
@@ -16,8 +16,7 @@ namespace QuestPDF.Examples
.PageSize(PageSizes.A4)
.ProducePdf()
.ShowResults()
.Render(x => x.Image(new byte[] { 1, 2, 3 }));
//.Render(x => GenerateStructure(x, 16));
.Render(x => GenerateStructure(x, 16));
}
private void GenerateStructure(IContainer container, int level)
@@ -33,7 +32,7 @@ namespace QuestPDF.Examples
if (level % 3 == 0)
{
container
.Border(level / 10f)
.Border(level / 4f)
.BorderColor(Colors.Black)
.Row(row =>
{
@@ -44,7 +43,7 @@ namespace QuestPDF.Examples
else
{
container
.Border(level / 10f)
.Border(level / 4f)
.BorderColor(Colors.Black)
.Stack(stack =>
{
+2
View File
@@ -36,6 +36,8 @@ namespace QuestPDF.Examples
RenderingTest
.Create()
.PageSize(350, 280)
.ProducePdf()
.ShowResults()
.Render(container =>
{
container
+3 -9
View File
@@ -46,16 +46,10 @@ namespace QuestPDF.Drawing
var metadata = document.GetMetadata();
var pageContext = new PageContext();
DebuggingState debuggingState = null;
if (System.Diagnostics.Debugger.IsAttached)
{
debuggingState = ApplyDebugging(content);
}
else
{
var debuggingState = metadata.ApplyDebugging ? ApplyDebugging(content) : null;
if (metadata.ApplyCaching)
ApplyCaching(content);
}
RenderPass(pageContext, new FreeCanvas(), content, metadata, debuggingState);
RenderPass(pageContext, canvas, content, metadata, debuggingState);
+4 -1
View File
@@ -23,7 +23,10 @@ namespace QuestPDF.Drawing
/// (likely due to infinite layout), the exception is thrown.
/// </summary>
public int DocumentLayoutExceptionThreshold { get; set; } = 250;
public bool ApplyCaching { get; set; } = !System.Diagnostics.Debugger.IsAttached;
public bool ApplyDebugging { get; set; } = System.Diagnostics.Debugger.IsAttached;
public static DocumentMetadata Default => new DocumentMetadata();
}
}
+1 -1
View File
@@ -109,7 +109,7 @@ namespace QuestPDF.Drawing.Proxy
Value = x.GetValue(element)
})
.Where(x => !(x.Value is IElement))
.Where(x => !(x.Value is IEnumerable<IElement>))
.Where(x => !(x.Value is IEnumerable))
.Where(x => !(x.Value is TextStyle))
.Select(x => $"{x.Property}: {FormatValue(x.Value)}");
+1 -1
View File
@@ -31,7 +31,7 @@ namespace QuestPDF.Drawing
if (Type == SpacePlanType.Wrap)
return Type.ToString();
return $"{Type} | width {Width:N2} | height {Height:N2}";
return $"{Type} (Width: {Width:N2}, Height: {Height:N2})";
}
public static implicit operator Size(SpacePlan spacePlan)
+2 -2
View File
@@ -22,9 +22,9 @@ namespace QuestPDF.Elements
if (Handler == null || skiaCanvas == null)
return;
var currentMatrix = skiaCanvas.TotalMatrix;
var originalMatrix = skiaCanvas.TotalMatrix;
Handler.Invoke(skiaCanvas, availableSpace);
skiaCanvas.SetMatrix(currentMatrix);
skiaCanvas.SetMatrix(originalMatrix);
}
}
}
+4 -2
View File
@@ -13,8 +13,10 @@ namespace QuestPDF.Elements.Text
public HorizontalAlignment Alignment { get; set; } = HorizontalAlignment.Left;
public List<ITextBlockItem> Children { get; set; } = new List<ITextBlockItem>();
public Queue<ITextBlockItem> RenderingQueue { get; set; }
public int CurrentElementIndex { get; set; }
public string Text => string.Join(" ", Children.Where(x => x is TextBlockSpan).Cast<TextBlockSpan>().Select(x => x.Text));
private Queue<ITextBlockItem> RenderingQueue { get; set; }
private int CurrentElementIndex { get; set; }
public void ResetState()
{
+1 -1
View File
@@ -16,6 +16,6 @@
Height = height;
}
public override string ToString() => $"(W: {Width}, H: {Height})";
public override string ToString() => $"(Width: {Width}, Height: {Height})";
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<Authors>MarcinZiabek</Authors>
<Company>CodeFlint</Company>
<PackageId>QuestPDF</PackageId>
<Version>2021.12.0-alpha0</Version>
<Version>2021.12.0-alpha1</Version>
<PackageDescription>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.</PackageDescription>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/Resources/ReleaseNotes.txt"))</PackageReleaseNotes>
<LangVersion>8</LangVersion>