Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antonov548/podofo.js
JavaScript interface for PoDoFo library
https://github.com/antonov548/podofo.js
js pdf pdf-document pdf-generation webassembly
Last synced: 2 months ago
JSON representation
JavaScript interface for PoDoFo library
- Host: GitHub
- URL: https://github.com/antonov548/podofo.js
- Owner: Antonov548
- Created: 2024-05-28T10:06:41.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-04T16:11:38.000Z (6 months ago)
- Last Synced: 2024-09-20T09:06:12.684Z (3 months ago)
- Topics: js, pdf, pdf-document, pdf-generation, webassembly
- Language: C++
- Homepage:
- Size: 921 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.
## NPM package
npm package is available - [npm/podofo.js](https://www.npmjs.com/package/podofo.js)```bash
npm i podofo.js
```## 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
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();```