FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

dotkarl/Verify.QuestPDF · GitHub

 
 

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verify.QuestPDF

Extends Verify to allow verification of documents via QuestPDF.

Designed to help assert the output of projects using QuestPDF to generate PDFs.

NuGet package

https://nuget.org/packages/Verify.QuestPDF/

Usage

Enable:

public static class ModuleInitializer
{
    [ModuleInitializer]
    public static void Init() =>
        VerifyQuestPdf.Initialize();
}

snippet source | anchor

Code that generates a document

static IDocument GenerateDocument() =>
    Document.Create(container =>
    {
        container.Page(page =>
        {
            page.Size(PageSizes.A5);
            page.Margin(1, Unit.Centimetre);
            page.PageColor(Colors.Grey.Lighten3);
            page.DefaultTextStyle(x => x.FontSize(20));

            page.Header()
                .Text("Hello PDF!")
                .SemiBold().FontSize(36);

            page.Content()
                .Column(x =>
                {
                    x.Item()
                        .Text(Placeholders.LoremIpsum());
                });

            page.Footer()
                .AlignCenter()
                .Text(x =>
                {
                    x.Span("Page ");
                    x.CurrentPageNumber();
                });
        });
    });

snippet source | anchor

Verify a Document

[Test]
public Task VerifyDocument()
{
    var document = GenerateDocument();
    return Verify(document);
}

snippet source | anchor

Results

Metadata

{
  Pages: 1,
  Metadata: {
    CreationDate: DateTime_1,
    ModifiedDate: DateTime_2,
    ImageQuality: 101,
    PdfA: false,
    RasterDpi: 72
  }
}

snippet source | anchor

Pdf as image

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL