---
Product: Aspose.PDF
Platform: typescript
Page Type: docs
Canonical URL: https://docs.aspose.org/pdf/typescript/getting-started/quickstart
---

# Quickstart

Build a PDF from scratch, add text and a second page, save it, then reload it to confirm the changes persisted, using Document, Page, and PageFormat.

## Overview

This page walks through the smallest useful cycle: create a new PDF, place
text on it, add a second page, save it to disk, and reopen the result to
confirm the page count and content survived the round trip.

---

### Prerequisites

| Requirement | Detail |
|-------------|--------|
| Node.js | 22 or later |
| Package | `@asposefoss/pdf` installed ([Installation](../installation/)) |

---

### 1. Create a document and add text

`Document.New()` takes a `PageFormat` and starts a document with one blank
page in that size. `doc.Pages[0]` is the first `Page`; `Page.AddText()`
places positioned text on it, and `Document.AddPage()` appends further
pages — here a landscape variant of the same format.

```typescript
import { Document, PageFormat } from '@asposefoss/pdf';

const doc = Document.New(PageFormat.A4);
doc.Pages[0].AddText('Hello from Aspose.PDF FOSS!', 72, 720, { fontSize: 14 });
doc.AddPage(PageFormat.A4.landscape());

console.log('Page count:', doc.Pages.length);
```

---

### 2. Save the document

Call `Document.WriteTo()` on the `doc` object built in step 1 to write it to
a file path — this is the same save call used throughout the developer
guide, and by default it produces a PDF with no additional compression
options.

```typescript
doc.WriteTo('quickstart.pdf');
```

---

### 3. Reopen and verify

`Document.OpenFile()` reads the `quickstart.pdf` file written in step 2 back
from disk into a new `Document` instance. Reading `Pages.length` on that
reopened document confirms both pages — the original A4 page and the
landscape page appended with `AddPage()` — were written correctly.

```typescript
const reopened = Document.OpenFile('quickstart.pdf');
console.log('Reloaded page count:', reopened.Pages.length); // 2
```

---

### Next Steps

- [Developer Guide](../../developer-guide/) — feature-level documentation
- [Core API](../../developer-guide/core-api/) — document and page management in depth

## See Also

- [Aspose.PDF — Enterprise Documentation](https://docs.aspose.com/pdf/)