BarCode.cs 909 B

123456789101112131415161718192021222324252627282930313233
  1. using System.IO;
  2. using NUnit.Framework;
  3. using QuestPDF.Drawing;
  4. using QuestPDF.Examples.Engine;
  5. using QuestPDF.Fluent;
  6. using QuestPDF.Helpers;
  7. using QuestPDF.Infrastructure;
  8. namespace QuestPDF.Examples
  9. {
  10. public class BarCode
  11. {
  12. [Test]
  13. public void Example()
  14. {
  15. FontManager.RegisterFontType("LibreBarcode39", File.OpenRead("LibreBarcode39-Regular.ttf"));
  16. RenderingTest
  17. .Create()
  18. .PageSize(400, 100)
  19. .FileName()
  20. .ShowResults()
  21. .Render(container =>
  22. {
  23. container
  24. .Background(Colors.White)
  25. .AlignCenter()
  26. .AlignMiddle()
  27. .Text("*QuestPDF*", TextStyle.Default.FontType("LibreBarcode39").Size(64));
  28. });
  29. }
  30. }
  31. }