This sample application demonstrates the usage of QuestPDF, a C# library for generating PDFs.
-
Clone the repository:
git clone https://github.com/schroedermarius/medium-questpdf-sample.git cd medium-questpdf-sample
-
Restore NuGet packages:
dotnet restore
-
Open the solution in your preferred IDE.
-
Navigate to the Program.cs file.
-
Modify the DocumentModel and AddressModel classes to suit your data structure.
-
Implement the MyDocument class by extending IDocument and define the PDF layout and content in the Compose method.
-
In the Main method of Program.cs, set the license type:
Settings.License = LicenseType.Community;
-
Generate the PDF:
var documentModel = new DocumentModel(); var document = new MyDocument(documentModel); // Generate and show the PDF document.GeneratePdfAndShow(); // Or to use the previewer // await document.ShowInPreviewerAsync();
-
Run the application to generate the PDF document.
This project is licensed under the MIT License.
Special thanks to QuestPDF for providing a powerful library for PDF generation.