deepseek-ai/dsh-libreoffice-kit
JavaScript
Captured source
source ↗deepseek-ai/dsh-libreoffice-kit
Description: An internal component used by DeepSeek Harness
Language: JavaScript
License: MPL-2.0
Stars: 20
Forks: 1
Open issues: 0
Created: 2026-09-30T06:28:16Z
Pushed: 2026-09-30T07:37:00Z
Default branch: master
Fork: no
Archived: no
README: --- description: "Font-friendly Office-to-PDF conversion in Node.js, with prebuilt LibreOffice engines." kind: "package-library" ---
@deepseek-ai/libreoffice-kit
English | [中文](README.zh.md)
Current goal
Font-friendly Office conversion and rendering in Node.js. Version 0.1.0 extends the stable 0.0.1 line with format conversion, spreadsheet recalculation, a CLI, direct PNG rendering, and shared converter-factory font caches while retaining the native engine packages.
The priorities are document layout and readable text, explicit control over available fonts and substitutions, and an engine that applications can bundle and run offline. Size reduction serves that goal: retain the import, layout, drawing, and PDF-export machinery these documents need while removing unrelated desktop features and resources.
The API supports Office export and recalculation plus direct PNG rendering of Office and PDF inputs. Use it in a Node.js service, a desktop application, or a document-processing job. Applications manage their own authorization, storage, and preview interfaces.
Binary .doc, .xls, and .ppt support covers OLE compound documents such as Office 97–2003. RTF/HTML files renamed to these suffixes and .wps are not accepted. missingFonts reports declarations found in OOXML; binary formats return an empty list while LibreOffice performs font matching.
Quick start
Requires Node.js 22.19.0 or newer. Install the 0.1.3 package with its optional engines:
npm install @deepseek-ai/libreoffice-kit@0.1.3
The package installs the dsoffice command. From a local installation:
npm exec -- dsoffice render --input report.docx --output-dir report-pages --pages 1 npm exec -- dsoffice convert --input report.docx --output report.pdf npm exec -- dsoffice recalculate --input budget.xlsx --output recalculated.xlsx
import { createConverter } from '@deepseek-ai/libreoffice-kit';
const converter = await createConverter({
timeoutMs: 120_000,
// Omit to discover fonts in conventional system/user directories.
// fontDirectories: ['/absolute/path/to/fonts'],
});
try {
const result = await converter.render({
inputPath: '/private/work/document.docx',
outputPath: '/private/work/document.pdf',
});
console.log(result.backend, result.missingFonts);
} finally {
await converter.dispose();
}Supply absolute paths in caller-owned private directories; the output must not already exist. The PDF is written to outputPath, and render returns the selected backend and missing-font names. Each render owns a fresh native process or Node worker and private profile. Renders on one converter are serialized; cancellation and disposal wait for engine exit and cleanup. See the [Node API](packages/entry/README.md) for cancellation, errors, and resource limits.
What “font-friendly” means in 0.1.0
- Use available fonts. The API discovers conventional system/user font directories, or indexes the roots supplied through
fontDirectories. Custom roots replace the default list.fontkitreads font metadata and glyph coverage; selected files are passed to the engine as original font bytes. - Preserve requested families when available. Exact installed families take priority, including handwriting and decorative fonts. WASM font requests also carry weight and italic information so matching installed faces can be selected; the catalog can supply additional fonts for missing glyphs.
- Make substitutions configurable. Default
fontFallbackscover common Latin and Simplified Chinese families, including Carlito for missing Calibri and Caladea for missing Cambria. Caller-supplied groups replace the defaults. These preferences only select available fonts; they do not install them. See the [default groups](packages/entry/src/options.ts). - Expose missing families and font budgets.
missingFontsreports unavailable families declared in readable document XML.maxFontFiles,maxFontFileBytes, andmaxLoadedFontBytesbound indexing and explicit imports. Each operation rediscovers and revalidates fonts. Unchanged file metadata is shared in memory and in a bounded user-local disk cache; see [cache options and invalidation](packages/entry/README.md#font-metadata-cache).
No font collection is bundled or downloaded. Deployments supply fonts appropriate to their documents and redistribution rights; minimal containers need fonts installed or a configured font directory. WASM uses only imported fonts and rejects conversion with unavailable if none are usable. Native macOS and Windows can also use OS-managed fonts.
This improves control over font choice, but does not guarantee identical output to Microsoft Office or between engines. Native LibreOffice resolves installed originals and metric-compatible families before configured substitutions, and handles face selection itself. Font metrics can change line breaks and pagination; missingFonts is not a complete missing-glyph report. Comparing engines requires identical document bytes, fonts, and export options.
Engines and distribution
The [Node package manifest](packages/entry/package.json) declares the engines for 0.1.0:
| Engine | Role | | --- | --- | | @deepseek-ai/libreoffice-kit-darwin-arm64 | Native helper for macOS on Apple Silicon. | | @deepseek-ai/libreoffice-kit-darwin-x64 | Native helper for Intel macOS. | | @deepseek-ai/libreoffice-kit-win32-arm64 | Native helper for Windows ARM64; requires ARM64 Node.js and the Microsoft Visual C++ v14 ARM64 Redistributable. | | @deepseek-ai/libreoffice-kit-win32-x64 | Native helper for Windows x64; requires the Microsoft Visual C++ v14 x64 Redistributable. | | @deepseek-ai/libreoffice-kit-wasm | Shared Node WASM engine for Linux. |
Other native directories are development recipes, not additional released targets. The shared WASM package declares Linux as its npm OS, with no CPU or libc restriction; that declaration alone does not certify every Linux host. Native and WASM engines perform layout and PDF serialization on the CPU.
npm installs only the matching native package on macOS/Windows ARM64 or x64, and WASM on Linux. macOS and Windows require their native...
Excerpt shown — open the source for the full document.