Quickstart

Quickstart

This guide shows how to get from a fresh .NET project to a saved PDF file in five steps.


Prerequisites

RequirementDetail
Runtime.NET 8.0 or later
OSWindows, Linux, or macOS
LicenseMIT — no key required

1. Install the package

Add Aspose.Pdf.Foss to your project:

dotnet add package Aspose.Pdf.Foss --version 0.1.0-alpha

See 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).");

Next Steps

See Also