2021-03-01 16:24:59 +01:00
|
|
|
using QuestPDF.Drawing;
|
2021-07-26 11:35:52 +02:00
|
|
|
using QuestPDF.Elements;
|
2021-03-01 16:24:59 +01:00
|
|
|
using QuestPDF.Fluent;
|
|
|
|
|
using QuestPDF.Helpers;
|
|
|
|
|
using QuestPDF.Infrastructure;
|
|
|
|
|
|
|
|
|
|
namespace QuestPDF.Examples.Engine
|
|
|
|
|
{
|
|
|
|
|
public class SimpleDocument : IDocument
|
|
|
|
|
{
|
2021-07-28 21:36:51 +02:00
|
|
|
public const int ImageScalingFactor = 2;
|
|
|
|
|
|
2021-03-01 16:24:59 +01:00
|
|
|
private IContainer Container { get; }
|
|
|
|
|
private Size Size { get; }
|
|
|
|
|
|
|
|
|
|
public SimpleDocument(IContainer container, Size size)
|
|
|
|
|
{
|
|
|
|
|
Container = container;
|
|
|
|
|
Size = size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DocumentMetadata GetMetadata()
|
|
|
|
|
{
|
|
|
|
|
return new DocumentMetadata()
|
|
|
|
|
{
|
2021-07-28 21:36:51 +02:00
|
|
|
RasterDpi = PageSizes.PointsPerInch * ImageScalingFactor,
|
2021-06-09 23:34:25 +02:00
|
|
|
DocumentLayoutExceptionThreshold = 10
|
2021-03-01 16:24:59 +01:00
|
|
|
};
|
|
|
|
|
}
|
2021-07-26 11:35:52 +02:00
|
|
|
|
|
|
|
|
public void Compose(IDocumentContainer container)
|
2021-03-01 16:24:59 +01:00
|
|
|
{
|
2021-07-26 11:35:52 +02:00
|
|
|
container.Page(page =>
|
|
|
|
|
{
|
|
|
|
|
page.Size(new PageSize(Size.Width, Size.Height));
|
2021-08-01 21:09:16 +02:00
|
|
|
page.Content().Container().Background(Colors.White).Element(Container as Container);
|
2021-07-26 11:35:52 +02:00
|
|
|
});
|
2021-03-01 16:24:59 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|