Skip to content

Antonov548/podofo.js

Repository files navigation

podofo.js

podofo.js is a JavaScript interface for the PoDoFo library.

Library provides functions to parse, create and modify PDF.

NPM package

npm package is available - npm/podofo.js

npm i podofo.js

Build with docker

podofo.js is a compiled PoDoFo library to WebAssembly using Emscripten. Docker image can be used to build library from scratch. This docker image contains minimal required tools and dependencies to build a JavaScript module.

Check CI pipeline for more details how to build library.

Example

import PodofoModule from 'podofo.js'

const Podofo = await PodofoModule();

const document = new Podofo.Document();
const pages = document.getPages();

const page = pages.createPage(
                   Podofo.getPageSize(Podofo.PageSize.A4, false));

const fonts = document.getFonts();
const font = fonts.getDefaultFont();

const painter = new Podofo.Painter();
painter.setCanvas(page);
painter.setFont(font, 10);
painter.drawText("Hello world!", 0, 0);
painter.finishDrawing();

const pdf = document.save();

painter.delete();
document.delete();

Releases

No releases published

Packages

No packages published