Quickstart
Quickstart
This guide shows how to get from a fresh .NET project to a saved PDF file in five steps.
Prerequisites
| Requirement | Detail |
|---|---|
| Runtime | .NET 8.0 or later |
| OS | Windows, Linux, or macOS |
| License | MIT — no key required |
1. Install the package
Add Aspose.Pdf.Foss to your project:
dotnet add package Aspose.Pdf.Foss --version 0.1.0-alphaSee Installation for NuGet Package Manager steps and namespace details.
2. Create a document and add a page
A new Document starts with no pages, so add one before writing any content:
using Aspose.Pdf;
var document = Document.Create();
var page = document.Pages.Add();3. Add text to the page
Build a TextFragment and add it to the page’s Paragraphs collection:
using Aspose.Pdf.Text;
var textFragment = new TextFragment("Hello, Aspose.PDF!");
page.Paragraphs.Add(textFragment);4. Save the document
document.Save("quickstart-output.pdf");5. Verify the result
Print the page count to confirm the document was built and saved:
Console.WriteLine($"Saved quickstart-output.pdf with {document.PageCount} page(s).");