Skip to content

"fs is not defined" in the prebuild version #623

Description

@kelvin200

Hi, I don't use NodeJS so I use the prebuild version of PDFKit to generate the PDF.
I imported the library in the HTML file
`<script src="Scripts/blob-stream.js" type="text/javascript"></script>

<script src="Scripts/pdfkit.js" type="text/javascript"></script>`

It worked well with built-in fonts.
When I registered a font from a file and used it
doc.registerFont('OpenSans-Regular', 'fonts/OpenSans-Regular.ttf', 'OpenSans-Regular'); doc.font('OpenSans-Regular');
I got this error
Uncaught ReferenceError: fs is not defined at Object.fontkit.openSync (pdfkit.js:16213) at Function.PDFFont.open (pdfkit.js:12888) at PDFDocument.font (pdfkit.js:14673)
Can anyone please guide me how to solve this problem?
Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions