-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Font not working #2862
Comments
@diegomura Could you help me on this? I am trying to fix this from last 2 days. |
Hello Rajat-Autofacets, I solved with this temporary fix "@react-pdf/font": { You need to fix this dependency inside your package.json. This code is from package-lock.json Let's hope it gets resolved soon |
Hi @RiccardoRiggi, Thank you so much for your quick response and for providing the solution! I tried installing the I attached image to show the result after install the package. Could you please help me troubleshoot this further or suggest any other steps I might try? Thanks again for your support! |
Try this in package.json: "overrides": { -- | "@react-pdf/font": "2.4.4", | },You need to override dependency used by react-pdf |
@RiccardoRiggi, It's not working. "@react-pdf/font": "2.4.4", |
@Rajat-Autofacets make sure you're placing Per the npm documentation:
|
Thank you for your response. I apologise for the misunderstanding. I have placed Could you please provide further guidance or suggestions on how to resolve this? |
Hi @Rajat-Autofacets Do an npm ci and check the actual version of the font library in the folder Have a nice day |
Yes, I removed the node_modules and package.lock.json and then make the changes in package.json file and run the npm i command. |
Hello @RiccardoRiggi & @coren-frankel, Is there any other way to fix this issue. Because I tried this but it's not worked for me. |
See if some of the solutions in #2730 help you. My use case is a bit different, I didn't override const styles = StyleSheet.create({
bold: { fontFamily: 'Helvetica-Bold' },
fallbackImg: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
zIndex: -1,
maxHeight: '256px',
borderRadius: '12px'
},
page: { padding: 10, fontFamily: 'Helvetica' },
underline: { textDecoration: 'underline' },
}); With this, I was able to pass |
Should be fixed in latest version. Please re-open if it's not the case |
I am experiencing an issue with [@react-pdf/renderer] where the
font-weight
property is not being applied correctly when generating PDFs. Despite specifying a font weight in the code, the output does not reflect this change. This issue is triggered for only a specific font family."@react-pdf/renderer": "^3.4.4",
"react": "^18.3.1",
// ===== Register Fonts =====
Font.register({
family: 'working-family'
fonts: [
{
src: 'path',
format: 'woff',
fontWeight: 'normal',
fontStyle: 'normal'
},
{
src: 'path',
format: 'woff',
fontWeight: 'bold',
fontStyle: 'normal'
},
],
});
Font.register({
family: 'not-working-family',
fonts: [
{
src: 'path',
format: 'woff',
fontWeight: 'normal',
fontStyle: 'normal'
},
{
src: 'path',
format: 'woff',
fontWeight: 'bold',
fontStyle: 'normal'
},
],
});
const DemoDocument = () => {
}
export default DemoDocument;
The text was updated successfully, but these errors were encountered: