Beispiel #1
0
        public void SkipOnce()
        {
            RenderingTest
            .Create()
            .ProduceImages()
            .ShowResults()
            .RenderDocument(container =>
            {
                container.Page(page =>
                {
                    page.Margin(20);
                    page.Size(PageSizes.A7.Landscape());
                    page.PageColor(Colors.White);

                    page.Header().Column(column =>
                    {
                        column.Item().ShowOnce().Text("This header is visible on the first page.");
                        column.Item().SkipOnce().Text("This header is visible on the second page and all following.");
                    });

                    page.Content()
                    .PaddingVertical(10)
                    .Text(Placeholders.Paragraphs())
                    .FontColor(Colors.Grey.Medium);

                    page.Footer().Text(text =>
                    {
                        text.Span("Page ");
                        text.CurrentPageNumber();
                        text.Span(" out of ");
                        text.TotalPages();
                    });
                });
            });
        }
Beispiel #2
0
        public void SpaceIssue()
        {
            RenderingTest
            .Create()
            .PageSize(PageSizes.A4)
            .ProducePdf()
            .ShowResults()
            .Render(container =>
            {
                container
                .Padding(20)
                .Padding(10)
                .MinimalBox()
                .Border(1)
                .Padding(5)
                .Padding(10)
                .Text(text =>
                {
                    text.DefaultTextStyle(x => x.Bold());

                    text.DefaultTextStyle(TextStyle.Default);
                    text.AlignLeft();
                    text.ParagraphSpacing(10);

                    text.Span(Placeholders.LoremIpsum());

                    text.EmptyLine();

                    text.Span("This text is a normal text, ");
                    text.Span("this is a bold text, ").Bold();
                    text.Span("this is a red and underlined text, ").FontColor(Colors.Red.Medium).Underline();
                    text.Span("and this is slightly bigger text.").FontSize(16);

                    text.EmptyLine();

                    text.Span("The new text element also supports injecting custom content between words: ");
                    text.Element().PaddingBottom(-4).Height(16).Width(32).Image(Placeholders.Image);
                    text.Span(".");

                    text.EmptyLine();

                    text.Span("This is page number ");
                    text.CurrentPageNumber();
                    text.Span(" out of ");
                    text.TotalPages();

                    text.EmptyLine();

                    text.Hyperlink("Please visit QuestPDF website", "https://www.questpdf.com");

                    text.EmptyLine();

                    text.Span(Placeholders.Paragraphs());


                    text.EmptyLine();

                    text.Span(Placeholders.Paragraphs()).Italic();

                    text.Line("This is target text that does not show up. " + Placeholders.Paragraph());
                });
            });
        }