You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So far, font data had to be embedded directly within the document
definition, despite being more logically associated with the renderer
than the document itself. This also made it hard to inspect or debug
document definitions due to the inclusion of large binary font data.
This commit introduces a new `PdfMaker` class that replaces the
`makePdf` function. This class allows font data to be registered
separately and reused across multiple documents. With this approach,
font data is no longer part of the document definition.
Example:
```ts
const pdfMaker = new PdfMaker();
pdfMaker.registerFont(await readFile('path/to/MyFont.ttf'));
pdfMaker.registerFont(await readFile('path/to/MyFont-Bold.ttf'));
const pdf1 = await pdfMaker.makePdf(doc1);
const pdf2 = await pdfMaker.makePdf(doc2);
```
0 commit comments