mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
* Bump fontkit and linebreak deps * Bump fontkit to 2.0.0 * Bump * Drop old node versions * Bump testing dependencies * Update pdfjs * fix jest to compatibility with restructure, update fontkit, refresh snapshots * Update CHANGELOG.md --------- Co-authored-by: Libor M. <liborm85@gmail.com>
pdfkit-webpack-example
Simple example of using PdfKit with webpack
Features
- Minimal webpack 5 setup
- Automatically register binary files added to static-assets folder
- Register AFM fonts provided by pdfkit
- Shows how to load and register files lazily
Technical details
- add alias to map
fscalls to pdfkit virtual file system implementation - ignore crypto package to save bundle file size
- add aliases to native node packages (buffer, stream, zlib, util, assert)
- configure
*.afmfiles to be imported as text - configure all files in
src/static-assetsfolder to be imported encoded as base64 - configure all files in
src/lazy-assetsfolder to be imported as URLs - convert binary files used by linebreak and fontkit to base64
Caveats
The strategy to register binary files and AFM fonts inlines them in source code, increasing the bundle size significantly