Browse Source

Add example for semantic text (temporary)

Marcin Ziąbek 3 months ago
parent
commit
25fa445671
1 changed files with 44 additions and 0 deletions
  1. 44 0
      Source/QuestPDF.Companion.TestRunner/Program.cs

+ 44 - 0
Source/QuestPDF.Companion.TestRunner/Program.cs

@@ -8,6 +8,50 @@ using QuestPDF.ReportSample.Layouts;
 
 Settings.License = LicenseType.Professional;
 
+Document
+    .Create(container =>
+    {
+        container.Page(page =>
+        {
+            page.Content()
+                .Padding(1, Unit.Centimetre)
+                .SemanticDocument()
+                .SemanticPart()
+                .SemanticParagraph()
+                // .DefaultTextStyle(x => x.DisableFontFeature(FontFeatures.StandardLigatures))
+                .Column(d =>
+                {
+                    d.Item().SemanticLanguage("en-US").SemanticSpan().Text(text =>
+                    {
+                        text.Span("This is a simple document with a Polish translation - isn't it nice, huh?");
+                    });
+                    
+                    d.Item().SemanticLanguage("pl-PL").SemanticSpan().Text(text =>
+                    {
+                        text.Span("To jest przykład dokumentu zawierającego tłumaczenie w języku polskim");
+                    });
+                    
+                    // d.Item().SemanticHeader("Top-Level Header").Text("Top-Level Header");
+                    //
+                    // d.Item().SemanticPart().Column(p =>
+                    // {
+                    //     p.Item().SemanticHeader("Second-Level Header 1").Text("Second-Level Header 1");
+                    //     p.Item().SemanticParagraph().Text(Placeholders.LoremIpsum());
+                    // });
+                    //
+                    // d.Item().SemanticPart().Column(p =>
+                    // {
+                    //     p.Item().SemanticHeader("Second-Level Header 2").Text("Second-Level Header 2");
+                    //     p.Item().SemanticParagraph().Text(Placeholders.LoremIpsum());
+                    // });
+                });
+        });
+    })
+    .WithMetadata(new DocumentMetadata() { Title = "Dupa!", Language = "en-US" })
+    .GeneratePdfAndShow();
+
+return;
+
 //await RunGenericException();
 //await RunLayoutError();
 await RunSimpleDocument();