Skip to content
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

How to custom fonts in nodejs? #1062

Closed
bimohxh opened this issue Jul 10, 2017 · 1 comment
Closed

How to custom fonts in nodejs? #1062

bimohxh opened this issue Jul 10, 2017 · 1 comment

Comments

@bimohxh
Copy link

bimohxh commented Jul 10, 2017

I use pdfmake in Nodejs! Nodejs ! Nodejs!

As #1044 say:

First, you need to convert your fonts to base64 format and copy it into vfs_fonts.js file.

To use any custom font, need to create an object of your available fonts as follows :

pdfMake.fonts = { OpenSans: { normal: 'OpenSans-Regular.ttf', bold: 'OpenSans-Bold.ttf', italics: 'OpenSans-Italic.ttf', bolditalics: 'OpenSans-BoldItalic.ttf' }, TimesRoman: { normal: 'TimesRoman-Regular.ttf', bold: 'TimesRoman-Bold.ttf', italics: 'TimesRoman-Italic.tt', bolditalics: 'TimesRoman-BoldItalic.ttf' }, Roboto: { normal: 'Roboto-Regular.ttf', bold: 'Roboto-Medium.ttf', italics: 'Roboto-Italic.ttf', bolditalics: 'Roboto-MediumItalic.ttf' } };

Use it in var dd

defaultStyle: { font: 'TimesRoman' },

good luck.

there is no vfs_fonts.js in server side mode.

what should node server client do to change font?

even no docs for server side use !!!

@bimohxh
Copy link
Author

bimohxh commented Jul 10, 2017

原来只能微软雅黑 foliojs/pdfkit#162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant