2021.3.0 Generating images functionality, ShowIf element, fixed mutating TextStyle

This commit is contained in:
Marcin Ziąbek
2021-03-01 16:24:59 +01:00
parent 35214892ef
commit 43c4011f91
11 changed files with 167 additions and 43 deletions
+7 -16
View File
@@ -6,6 +6,7 @@ using System.Reflection;
using NUnit.Framework;
using QuestPDF.Drawing;
using QuestPDF.Elements;
using QuestPDF.Fluent;
using QuestPDF.Infrastructure;
using SkiaSharp;
@@ -60,23 +61,13 @@ namespace QuestPDF.Examples.Engine
var container = new Container();
methodInfo.Invoke(this, new object[] {container});
var iteration = 1;
Func<int, string> fileNameSchema = i => $"{fileName.ToLower()}-${i}.png";
while (iteration <= 1)
{
var imageData = RenderPage(container, size);
if (imageData == null)
return;
var path = Path.Combine(ResultPath, $"{fileName.ToLower()}-${iteration}.png");
File.WriteAllBytes(path, imageData);
if (showResult)
Process.Start("explorer", path);
iteration++;
}
var document = new SimpleDocument(container, size);
document.GenerateImages(fileNameSchema);
if (showResult)
Process.Start("explorer", fileNameSchema(0));
}
private byte[] RenderPage(Element element, Size size)