Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonov548 committed Jun 1, 2024
2 parents ff1a65d + c47776f commit 3d3f065
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# podofo.js

podofo.js is a JavaScript interface for the [PoDoFo](https://github.com/podofo/podofo) library.

Library provides functions to parse, create and modify PDF.

## Build with docker

podofo.js is a compiled PoDoFo library to WebAssembly using Emscripten.
Docker [image](https://github.com/Antonov548/podofo.js-docker) 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](https://github.com/Antonov548/podofo.js/blob/main/.github/workflows/ci.yaml) for more details how to build library.

## Example
```js

const PodofoModule = require('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();

```

0 comments on commit 3d3f065

Please sign in to comment.