Get started with the Server SDK
Open, annotate, convert, render and save documents on the server. This guide uses Node.js.
Choose your platform
Also
The native .NET and C libraries are built for macOS on Apple Silicon today; Linux and Windows builds are coming soon. Node.js runs everywhere.
Install
npm install docuverseNode.js 18 or later. The engine loads its files from the package by itself.
A licence key is needed: without one, nothing opens. Make a free account for trial keys (everything works, with a watermark), or choose a plan on the pricing page. Each key is for one SDK, made in your account under Keys: a Web SDK key for the viewer in websites (
licenseKey), a Server SDK key for Node.js (setLicenseKey(key)) and .NET (License.SetKey(key)), a Mobile SDK key for apps. A key used with another SDK is refused with an error that says which key to make.Annotate a file
import { readFileSync, writeFileSync } from 'node:fs';import { init, PdfDocument } from 'docuverse'; await init();const doc = PdfDocument.open(readFileSync('invoice.pdf')); // a PDF, or a .docx laid out as pagesconsole.log(doc.pageCount, doc.pageText(0)); for (const hit of doc.search('Total')) { doc.addAnnotation(hit.page, { type: 'Highlight', quadPoints: hit.quadPoints });}doc.addAnnotation(0, { type: 'Stamp', rect: [400, 700, 560, 750], icon: 'Approved' }); writeFileSync('page1.png', doc.renderPagePng(0, 2));writeFileSync('invoice-reviewed.pdf', doc.save({ incremental: true }));doc.close();Word and Excel
import { init, WordDocument, ExcelDocument } from 'docuverse';await init(); const word = WordDocument.open(readFileSync('report.docx'));writeFileSync('report.pdf', word.pdf()); const book = ExcelDocument.open(readFileSync('budget.xlsx'));writeFileSync('budget.pdf', book.pdf()); // every visible sheet, with its page setup