Read Apple iWork files (.pages, .numbers, .key) anywhere Apple's apps don't run.
Modern iWork documents are zip archives whose internals are proprietary protobuf (IWA format — undocumented, painful). But nearly every file saved by Pages, Numbers, or Keynote also ships with an embedded QuickLook preview PDF that captures the exact layout of the document.
This package finds that PDF and hands it to you. One function, one dependency (fflate), works in Node and the browser.
npm install iwork-previewimport { extractPreviewPdf, kindForFilename } from "iwork-preview";
import { readFileSync, writeFileSync } from "node:fs";
const pdf = extractPreviewPdf(readFileSync("report.pages"));
if (pdf) writeFileSync("report.pdf", pdf); // exact-layout PDF of the documentFrom the PDF you can go anywhere: extract the text layer (e.g. with unpdf) and build a .docx, re-table it into .xlsx, or just serve the PDF itself.
- The file was saved without a preview (in the iWork app: File → Advanced → Include Preview in Document)
- Very old pre-2013 iWork files that aren't zip archives
Powers the converters at pagestoword.com, numberstoexcel.com, and keynotetopowerpoint.com — free in-browser iWork conversion, no Mac needed.
MIT © Zac Frulloni