@unionpdf/engines
TypeScript icon, indicating that this package has built-in type declarations

0.24.0 • Public • Published

@unionpdf/engines

This package defines engines used for parsing PDF files. Right now, we only provide one PDF engine that is based on PDFium and a mock of engine for testing purpose.

Install

npm install @unionpdf/engines

Usage

import { createPdfiumModule, PdfiumEngine } from '@unionpdf/engines';

// implement loadWasmBinary to load pdifum wasm file
const wasmBinary = await loadWasmBinary();
const wasmModule = await createPdfiumModule({ wasmBinary });
const engine = new PdfiumEngine(wasmModule, new ConsoleLogger());

engine.initialize();

// implement fetchFile to load pdf file
const file = await loadFile();
const task = engine.openDocument(file);
task.wait(
  (doc) => {
    console.log('opened: ', doc);

    engine.closeDocument(doc);
  },
  (err) => {
    console.log('failed: ', err);
  },
);

Readme

Keywords

Package Sidebar

Install

npm i @unionpdf/engines

Weekly Downloads

169

Version

0.24.0

License

MIT

Unpacked Size

6.37 MB

Total Files

19

Last publish

Collaborators

  • jichang_dev