Browse Source

Documentation Examples improvements

Marcin Ziąbek 10 months ago
parent
commit
d8a0882b7d

+ 6 - 7
Source/QuestPDF.DocumentationExamples/BarcodeExamples.cs

@@ -1,4 +1,3 @@
-using System.Text.Json;
 using QuestPDF.Fluent;
 using QuestPDF.Helpers;
 using QuestPDF.Infrastructure;
@@ -30,7 +29,7 @@ public class BarcodeExamples
                         .Padding(25)
                         .Row(row =>
                         {
-                            var productId = Random.Shared.NextInt64() % 1_000_000_000_000;
+                            var productId = Random.Shared.NextInt64() % 10_000_000;
                             
                             row.Spacing(20);
 
@@ -39,7 +38,7 @@ public class BarcodeExamples
                                 text.ParagraphSpacing(10);
                                 
                                 text.Span("Product ID: ").Bold();
-                                text.Line(productId.ToString("D12"));
+                                text.Line(productId.ToString("D7"));
                                 
                                 text.Span("Name: ").Bold();
                                 text.Line(Placeholders.Label());
@@ -56,12 +55,12 @@ public class BarcodeExamples
                                 .Height(75)
                                 .Svg(size =>
                                 {
-                                    var content = productId.ToString("D12");
+                                    var content = productId.ToString("D7");
                                     
-                                    var writer = new EAN13Writer();
-                                    var eanCode = writer.encode(content, BarcodeFormat.EAN_13, (int)size.Width, (int)size.Height);
+                                    var writer = new EAN8Writer();
+                                    var eanCode = writer.encode(content, BarcodeFormat.EAN_8, (int)size.Width, (int)size.Height);
                                     var renderer = new SvgRenderer { FontName = "Lato", FontSize = 16 };
-                                    return renderer.Render(eanCode, BarcodeFormat.EAN_13, content).Content;
+                                    return renderer.Render(eanCode, BarcodeFormat.EAN_8, content).Content;
                                 });
                         });
                 });

+ 0 - 1
Source/QuestPDF.DocumentationExamples/ComplexGraphicsExamples.cs

@@ -20,7 +20,6 @@ public class ComplexGraphicsExamples
                     page.Margin(25);
                     
                     page.Content()
-                        .Shrink()
                         .Layers(layers =>
                         {
                             layers.Layer().Svg(size =>

+ 3 - 6
Source/QuestPDF.DocumentationExamples/MapExample.cs

@@ -42,16 +42,13 @@ public class MapExample
             {
                 document.Page(page =>
                 {
-                    page.MinSize(new PageSize(0, 0));
-                    page.MaxSize(new PageSize(1000, 1000));
-                    page.DefaultTextStyle(x => x.FontSize(20));
+                    page.ContinuousSize(550);
+                    page.Margin(25);
 
                     page.Content()
-                        .Width(550)
-                        .Padding(25)
                         .Column(column =>
                         {
-                            column.Item().Text("Map of Kraków").Bold();
+                            column.Item().Text("Map of Kraków").FontSize(20).Bold();
                             column.Item().Text("Capital of Lesser Poland Voivodeship").FontSize(16).Light();
                             column.Item().Height(15);