0

I'm trying to use custom ttf fonts in PDFKit with Javascript. Fonts are stored locally. I'm getting a TypeError: fs.readFileSync is not a function on contents = fs.readFileSync(filename); of pdfkit.js (line 2429).

I've tried many different custom fonts with no luck. I guess I'm not using the right path format. Standard 14 fonts work fine.

here's my code portion:

var doc = new PDFDocument();
var stream = doc.pipe(blobStream());

        doc.font('fonts/ARLRDBD.ttf')
        .fontSize(15)
        .text(mytext, 100, 66);

        doc.end();
Amirali
  • 116
  • 7

0 Answers0