Aspose.PDF FOSS for TypeScript is an open-source library for creating, editing, converting,
and securing PDF documents in Node.js (>=22) applications. The Document and Page classes
are the central entry points: Document.OpenFile() / Document.Open() load existing files
or in-memory bytes, Document.New() starts a blank document, and WriteTo() / Save()
write the result back out, optionally with xref-stream compression. The project is a
zero-dependency package (Node.js is the only runtime requirement) and is under active
early-stage development (currently version 0.1.0).
Beyond core document and page editing — splitting, merging, extracting, reordering, and
appending pages with Document.Split(), Document.Merge(), Document.ExtractPages(), and
Document.Append() — the library converts pages and whole documents to other formats with
ToHtml(), ToMarkdown(), ToDocx(), ToSvg(), ToImage(), and ToEpub(). Annotation
support covers highlight, underline, squiggly, strikeout, link, text-note, free-text, and
stamp markup through methods like Page.AddHighlight() and Page.AddStamp(). AcroForm
fields (text, checkbox, radio, combo box, list box, and push button) are built with the
Form class and its typed Field subclasses, and documents can be encrypted with AES-128,
AES-256, or RC4, digitally signed with Document.Sign(), and redacted with
Document.Redact() / Page.ApplyRedactions().
Aspose.PDF FOSS for TypeScript is released under the MIT license with no runtime fees or usage restrictions (see the install section below). For the enterprise product family, see Aspose.PDF — Enterprise Product Family.
Document.OpenFile() / Document.Open(), or start blank with Document.New()Document.Split(), Document.Merge(), Document.ExtractPages(), Document.Reorder(), and Document.Append()Document.SetMetadata() / Document.GetMetadata()Document.WriteTo(), optionally compressed via xref streams and object streamsDocument.ToHtml() and to GitHub-flavored Markdown with Document.ToMarkdown().docx output with Document.ToDocx() / Page.ToDocx()Page.ToSvg() or raster PNG/TIFF bytes with Page.ToImage()Document.ToEpub() for e-reader distributionPage.AddHighlight(), Page.AddUnderline(), Page.AddSquiggly(), and Page.AddStrikeOut()Page.AddTextNote() and Page.AddFreeText()Page.AddStamp() and clickable links with Page.AddLink()Annotation.Flatten() method exposed on typed subtypes like MarkupAnnotation and StampAnnotationForm class (AddTextField(), AddCheckbox(), AddRadioGroup(), AddComboBox(), AddListBox(), AddPushButton())SetStyle() and GenerateAppearance() on typed field classes such as TextField, ChoiceField, and ButtonFieldSetActions() on any FieldDocument.FlattenForm()Document.WriteTo()’s encrypt option, with granular PermissionsDocument.Sign() and verify signatures with Document.VerifySignatures()Document.AddDocumentTimestamp()Document.Redact(), Document.RedactText(), and Page.ApplyRedactions()Open a PDF and render it out to several downstream formats in one pass.
asposefoss/pdf is not yet published — build from source until it ships. See the project README for build instructions.import { Document } from '@asposefoss/pdf';
const doc = Document.OpenFile('in.pdf');
const svg = doc.Pages[0].ToSvg(); // standalone <svg> string
// fs.writeFileSync('page1.svg', svg);
const png = doc.Pages[0].ToImage({ scale: 2 }); // Uint8Array of PNG bytes @144 DPI
// fs.writeFileSync('page1.png', png);
const html = doc.ToHtml(); // standalone semantic HTML, all pages
// fs.writeFileSync('out.html', html);
const md = doc.ToMarkdown(); // GFM Markdown, all pages
// fs.writeFileSync('out.md', md);
const docx = doc.ToDocx(); // .docx bytes, reflowed, images in the package
// fs.writeFileSync('out.docx', docx);
const fixed = doc.ToDocx({ mode: 'textbox' }); // .docx keeping each page's own geometry
// fs.writeFileSync('fixed.docx', fixed);
Load a PDF, edit its pages and metadata, and write it back out with compression.
import { Document } from '@asposefoss/pdf';
// Open from disk (or Document.Open(uint8array) for in-memory data)
const doc = Document.OpenFile('input.pdf');
// Inspect and edit pages
console.log(doc.Pages.length);
doc.Pages[0].Rotate = 90;
doc.RemovePage(2); // 1-based page number
doc.Reorder([3, 1, 2]);
// Metadata
doc.SetMetadata({ title: 'Report', author: 'Jane', custom: { Dept: 'R&D' } });
// Save
doc.WriteTo('output.pdf'); // or: const bytes = doc.Save();
doc.WriteTo('small.pdf', { compressed: true }); // xref stream + object streams
Start a blank document, add positioned text, and append another page.
import { Document, PageFormat } from '@asposefoss/pdf';
const doc = Document.New(PageFormat.A4); // one blank A4 page
doc.Pages[0].AddText('Hello', 72, 720, { fontSize: 14 });
doc.AddPage(PageFormat.A4.landscape()); // append more as you go
doc.WriteTo('scratch.pdf');
Encrypt an existing PDF with a user/owner password pair and AES-256, restricting copying and modification.
import { Document } from '@asposefoss/pdf';
const doc = Document.OpenFile('in.pdf');
doc.WriteTo('locked.pdf', {
encrypt: {
userPassword: 'open-me', // required to open (default '')
ownerPassword: 'full-rights', // default: same as userPassword
algorithm: 'aes256', // 'aes256' (default) | 'aes128' | 'rc4'
permissions: { copying: false, modifying: false },
encryptMetadata: true,
},
});
Aspose.PDF FOSS for TypeScript is released under the MIT License, allowing free use in commercial products with no runtime fees. The source code is publicly available on GitHub.
The package targets Node.js 22 and later and has no other runtime dependencies. See the install section above for the current install command.
The library reads and writes PDF, Markdown, SVG, and TIFF, and can generate DOCX, HTML, PNG, and EPUB output.
Use Document.New(PageFormat.A4) to produce a blank document, then add pages and save with Document.WriteTo().
No license key or activation step is required. The library runs fully unlicensed at no cost under the MIT License.