Created
October 26, 2024 06:15
-
-
Save documentprocessing/8e26e6c879b4f8bc89c588702f4a5db9 to your computer and use it in GitHub Desktop.
Create PDF using QuestPDF for .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using QuestPDF.Fluent; | |
using QuestPDF.Helpers; | |
using QuestPDF.Infrastructure; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Create a PDF document | |
Document.Create(document => | |
{ | |
// Define document structure | |
document.Page(page => | |
{ | |
// Set page size and margin | |
page.Size(PageSizes.A4); | |
page.Margin(2, Unit.Centimetre); | |
// Add a blank content area | |
page.Content().Background(Colors.White); | |
}); | |
}) | |
.GeneratePdf("BlankDocument.pdf"); // Save the PDF to a file | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment