SimpleDocument.cs 775 B

123456789101112131415161718192021222324252627282930313233
  1. using QuestPDF.Drawing;
  2. using QuestPDF.Fluent;
  3. using QuestPDF.Helpers;
  4. using QuestPDF.Infrastructure;
  5. namespace QuestPDF.Examples.Engine
  6. {
  7. public class SimpleDocument : IDocument
  8. {
  9. private IContainer Container { get; }
  10. private Size Size { get; }
  11. public SimpleDocument(IContainer container, Size size)
  12. {
  13. Container = container;
  14. Size = size;
  15. }
  16. public DocumentMetadata GetMetadata()
  17. {
  18. return new DocumentMetadata()
  19. {
  20. RasterDpi = PageSizes.PointsPerInch * 2,
  21. Size = Size
  22. };
  23. }
  24. public void Compose(IContainer container)
  25. {
  26. container.Element(Container.Child);
  27. }
  28. }
  29. }