小Roy
Convex Community2y ago
17 replies
小Roy

Use pdfkit in actions

Hi all, I am trying to create an action to generate pdf and store that in files storage. I am using the pdfkit to generate the pdf. https://github.com/foliojs/pdfkit

I ran into error saying it's something wrong with loading the fonts. However, when I try to do this in a node another node backend server, I don't see the same issue.

Could somebody give me a hint how should I approach this?

"use node"

import PDFDocument from "pdfkit";

export const generatePDF = internalAction({
  args: {},
  handler: async (ctx, args) => {
    const doc = new PDFDocument({size: [4*72, 6*72]});
  }
})
Screenshot_2024-08-23_at_10.51.06_AM.png
GitHub
A JavaScript PDF generation library for Node and the browser - foliojs/pdfkit
GitHub - foliojs/pdfkit: A JavaScript PDF generation library for No...
Was this page helpful?