DecorationExamples.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using QuestPDF.Fluent;
  2. using QuestPDF.Helpers;
  3. using QuestPDF.Infrastructure;
  4. namespace QuestPDF.DocumentationExamples;
  5. public class DecorationExamples
  6. {
  7. [Test]
  8. public void Example()
  9. {
  10. Document
  11. .Create(document =>
  12. {
  13. document.Page(page =>
  14. {
  15. page.MinSize(new PageSize(350, 0));
  16. page.MaxSize(new PageSize(350, 300));
  17. page.Margin(25);
  18. page.DefaultTextStyle(x => x.FontSize(20));
  19. page.Content()
  20. .Background(Colors.Grey.Lighten3)
  21. .Padding(15)
  22. .Decoration(decoration =>
  23. {
  24. decoration
  25. .Before()
  26. .DefaultTextStyle(x => x.Bold())
  27. .Column(column =>
  28. {
  29. column.Item().ShowOnce().Text("Customer Instructions:");
  30. column.Item().SkipOnce().Text("Customer Instructions [continued]:");
  31. });
  32. decoration
  33. .Content()
  34. .PaddingTop(10)
  35. .Text("Please wrap the item in elegant gift paper and include a small blank card for a personal message. If possible, remove any price tags or invoices from the package. Make sure the wrapping is secure but easy to open without damaging the contents.");
  36. });
  37. });
  38. })
  39. .GenerateImages(x => $"decoration-{x}.webp", new ImageGenerationSettings() { ImageFormat = ImageFormat.Webp, ImageCompressionQuality = ImageCompressionQuality.VeryHigh, RasterDpi = 144 });
  40. }
  41. }