/ src / utils / fonts.ts
fonts.ts
 1  import { StandardFonts as Fonts } from "@cantoo/pdf-lib";
 2  
 3  export type Font = ArrayBuffer | Fonts | string | Uint8Array;
 4  export class MemoryFont {
 5    public id: string = crypto.randomUUID();
 6    constructor(public value: Font) {}
 7  }
 8  
 9  export { Fonts };
10  /**
11   * Creates a font reference that'll be used across the PDF tree.
12   */
13  export const font = (font: Font): MemoryFont => new MemoryFont(font);