Node.js library

officepress

Word, Excel, PowerPoint, OpenDocument, Visio and Publisher files to PDF, inside your own Node.js process.

No heavy software dependencies No network access PDF/A, tagged PDF
convert.js
import { readFile, writeFile } from 'node:fs/promises';
import { convertToPdf } from '@toupiesoft/officepress';

const docx = await readFile('report.docx');
const pdf = convertToPdf(docx);   // in process, offline
await writeFile('report.pdf', pdf);

Demonstration: a conversion in a Node.js script, a batch of 12 files in 9 formats, and pages compared with the print of the application that made them.

What you can build

/01

Air-gapped document systems

Archive, preview and edit documents on a network without internet access. Conversion runs inside your own Node.js process.

/02

Bulk conversion of legacy files

Turn archives of .doc, .xls, .ppt, Visio and Publisher files into PDF in parallel worker processes, with a time limit per file.

/03

Long-term archives

PDF/A output (levels 2 and 3) for records that must stay readable for decades, with optional password protection and file compression.

/04

Automation and AI pipelines

Each document can also come out as structured JSON (text, styles, tables, layout), ready for search indexes, data extraction or language models.

/05

Document generation

Write Word documents from JSON and Excel or OpenDocument workbooks from your data, then print them to PDF in the same step.

/06

Previews in your own application

Page images and PDFs of uploaded files for portals, ticket systems and viewers, on the server or in the browser.

Formats

Word, Excel and PowerPoint from 97 to today, OpenDocument, Visio and Publisher.

WordAll licences
.docx .docm .dotx .rtf
ExcelAll licences
.xlsx .xlsm .xlsb
PowerPointAll licences
.pptx .pptm
OpenDocumentAll licences
.odt .ods .odp .odg, flat XML
Office 97–2003Business
.doc .xls .ppt
VisioBusiness
.vsdx .vsd .vdx, stencils, templates
PublisherBusiness
.pub, from Publisher 98
OtherAll licences
.svg, password-protected Office files

Compare with the print

Examples →
Visio drawing printed by Visio (left) and converted by officepress (right).
Visio drawing printed by Visio (left) and converted by officepress (right).
Publisher poster printed by Publisher (left) and converted by officepress (right).
Publisher poster printed by Publisher (left) and converted by officepress (right).

In detail

What is rendered
  • Text documents: styles, lists, tables (merged and nested cells, repeated header rows), sections with their own page size and headers, footnotes and endnotes, columns, tab stops, fields (table of contents with page numbers, PAGE, REF, SEQ, DATE), equations, comments and tracked changes on request, hyperlinks and PDF bookmarks.
  • Spreadsheets: number and date formats, conditional formatting (colour scales, data bars, icon sets), charts and pictures at their anchor, print areas, fit to page, repeated titles, page breaks, headers and footers. Formulas are not recalculated: the values saved in the file are printed.
  • Presentations: masters and layouts, theme colours, gradients, pictures, tables, charts, SmartArt from the drawing stored in the file, speaker notes and hidden slides on request.
  • Visio: inheritance from masters and themes, geometry (arcs, splines, NURBS), connectors with arrowheads, fill patterns and gradients, scaled drawings, several pages.
  • Publisher: text frames and linked stories, master pages, pictures, shapes, tables, hyphenation in eight languages.
  • Fonts: fonts installed on the server are matched by name. When Arial, Times New Roman, Courier New or Calibri are missing, bundled metric-compatible fonts keep the line breaks. Bundled Noto fonts cover Greek, Cyrillic, Hebrew, Arabic, Devanagari, Thai, Chinese, Japanese and Korean.
  • PDF output: PDF 1.4; PDF/A-2b, 2u, 2a, 3b, 3u and 3a, checked with veraPDF 1.30.2; tagged PDF; PDF/UA-1 for Word files. The same input gives the same PDF, byte for byte.
Safety
  • At run time the library uses only modules built into Node.js: zlib, fs, crypto, path, os, url and worker_threads. No npm package is installed with it.
  • No network access, no child processes, no eval or new Function, no native add-ons.
  • No external calls: the library contacts neither ToupieSoft nor anyone else.
  • Macros are never run. Macro-enabled files are converted without them.
  • Corrupt or unsupported input raises a typed error. A damaged legacy file falls back to its text.
  • convertToPdfAsync runs in a worker thread and accepts a time limit (timeoutMs).
Performance

Measured on 14 October 2026 with officepress c98a0ac: each document converted three times in one Node.js process; the median of runs 2 and 3 is reported. Laptop with AMD Ryzen 9 5900HS (8 cores), 32 GB RAM, Windows 10, Node.js 24.15. A conversion uses one core.

DocumentsMedian per page95 % of files under
Word, RTF, OpenDocument text34 ms1.5 s
Spreadsheets25 ms0.85 s
Presentations31 ms1.7 s
Visio36 ms0.36 s
Publisher22 ms5.4 s
All31 ms1.7 s

Large files need time and memory: a 102 MB Publisher file takes 5.5 s and adds 670 MB to the process memory. For a server, run conversions in a pool of worker threads and limit the upload size.

How fidelity is checked

Every version is compared page by page with the PDF printed by the application that made the document: Word, Excel, PowerPoint and Publisher 2021, Visio 2019, LibreOffice for OpenDocument. Each difference found is recorded with the file, the page and an image, and a correction counts only when the document itself prints correctly.

The examples come from this test bed. Download the source file and both PDFs, and compare.

Limits
  • Formulas are not recalculated.
  • The PDF output is not encrypted and not signed.
  • WordArt warps and 3-D effects are rendered only in part.
  • Scripts other than Latin, Greek, Cyrillic, Hebrew, Arabic, Devanagari, Thai and CJK are drawn without full shaping.
  • When a font is missing on the server, line breaks can differ slightly from Office.

The complete list is in the documentation.

Integration
import { convertToPdf } from '@toupiesoft/officepress';

app.get('/documents/:id/preview.pdf', async (req, res) => {
  const file = await storage.read(req.params.id);       // your storage
  res.type('application/pdf').send(convertToPdf(file));  // in-process, offline
});
  • In process: convertToPdf is synchronous; suitable for scripts, batch jobs and low traffic.
  • Worker pool: for a preview service, a fixed pool of worker_threads behind a queue, sized at the number of cores minus one. See Document previews.

Try it on your own files

A 30-day trial licence: the full library in your own application.