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

Multiple fonts not working #2709

Closed
dhwaj1902 opened this issue Apr 7, 2024 · 2 comments
Closed

Multiple fonts not working #2709

dhwaj1902 opened this issue Apr 7, 2024 · 2 comments

Comments

@dhwaj1902
Copy link

Describe the bug
I want to register multiple fonts in react-pdf, but blank screen is coming. Only Roboto font is working while creating the pdf.
image

To Reproduce
Steps to reproduce the behavior including code snippet (if applies):
Using the code:
Font.register({ family: 'Lato', fonts: [ { src: '/font/Lato-Regular.ttf', fontWeight: 400, }, { src: '/font/Lato-Italic.ttf', fontStyle: 'italic', }, { src: '/font/Lato-Bold-Italic.ttf', fontWeight: 500, fontStyle: 'italic', }, { src: '/font/Lato-Bold.ttf', fontWeight: 600, }, { src: '/font/Lato-Bold.ttf', fontWeight: 700, }, { src: '/font/Lato-Bold.ttf', fontWeight: 800, }, ], });

Font.register({ family: 'Roboto', fonts: [ { src: '/font/Roboto-Regular.ttf', fontWeight: 400, }, ... same ], });

Font.register({ family: 'Inter', fonts: [ { src: '/font/Inter-Regular.ttf', fontWeight: 400, }, ... same ], });

Expected behavior
If used any of the above registered fonts in the body font-family, then the font should come.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • React-pdf version: 6.2.2
@guillaumeklaus
Copy link

I had the same issue and solved it with this : #2675 (comment)

@dhwaj1902
Copy link
Author

Thanks a lot that works for me!

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

2 participants