New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to require TTFFont with Browserify? #354
Comments
You can load the ttf into an arraybuffer using ajax and pass that to |
It worked. Thanks so much! |
It is also possible to bypass the AJAX call if you want to embed the font data into your javascript directly. First, you need to include this Buffer implementation: https://github.com/feross/buffer Then, you will need to base64-encode the contents of the file somehow. Finally, do something like:
|
If you're using browser, I recommend brfs to automatically turn |
Hey, thanks for this library.
I need to embed a custom font in a browser-generated PDF. It seems that’s not currently possible, but if I could instantiate a
TTFFont
in my build step withTTFFont.open("path/to/font", "Font Name")
, (I think?) I could pass it todoc.font
when I’m generating the PDF.Is there a way to require
TTFFont
? I’m not Node-experienced enough to know how, my naïve attempts likerequire('pdfkit').TTFFont
andrequire('pdfkit/font/ttf')
have all failed.Or maybe I should just read the
.ttf
into a buffer myself?The text was updated successfully, but these errors were encountered: