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

@react-pdf/[email protected] font.layout is not a function #2990

Open
ShiraDC opened this issue Dec 1, 2024 · 3 comments
Open

@react-pdf/[email protected] font.layout is not a function #2990

ShiraDC opened this issue Dec 1, 2024 · 3 comments

Comments

@ShiraDC
Copy link

ShiraDC commented Dec 1, 2024

Describe the bug
After upgrading @react-pdf/renderer from 3.4.4 to 4.1.5 which updates the react-pdf/textkit to 5.0.1 I get the error:
TypeError: font.layout is not a function

To Reproduce
I cannot open my PDF, as it won't render. Didn't make any changes to my code since the last version.
I am adding fonts to my pdf:
Font.register({ family: 'Manrope', fonts: [ { src: manrope }, { src: manropeLight, fontWeight: 'light' }, { src: manropeMedium, fontWeight: 'medium' }, { src: manropeSemibold, fontWeight: 'bold' }, { src: manropeBold, fontWeight: 'ultrabold' } ] }) Font.register({ family: 'Roboto Slab', fonts: [{ src: robotoSlab }, { src: robotoSlabBold, fontWeight: 'bold' }] })

and implement them on each page:
const styles = StyleSheet.create({ page: { backgroundColor: '#f7f7f7', color: colorPalette.dcPurple, position: 'relative', fontFamily: 'Manrope' }, main: { backgroundColor: colorPalette.dcDark, paddingTop: '30pt' } })

Expected behavior
PDF will render as before

Screenshots
Screenshot 2024-12-01 at 12 13 09

Desktop (please complete the following information):

  • OS: MacOS
  • Browser chrome
  • React-pdf version 4.1.5
@diegomura
Copy link
Owner

I'll need that font to test. Can you provide it?

@pranavavva
Copy link

Hi, we're also having this issue but we're using the Arial font in our PDFs. We're on @react-pdf/renderer 3.4.2 and react-pdf 8.0.2.

@ShiraDC
Copy link
Author

ShiraDC commented Dec 22, 2024

I'll need that font to test. Can you provide it?

Hi, I added one example in the first comment, but the family font is Manrope and Roboto Slab

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

No branches or pull requests

3 participants