Comments (16)
this also breaks registering fonts like SFMono-Semibold.ttf, it never loads pdf get stuck rendering
from react-pdf.
we made it work (somehow).
(thx @bdkopen for your hint)
we downgraded to "@react-pdf/renderer": "3.1.9"
needed to use npm i
instaed of yarn
(maybe issues with yarn ???) and use one package-lock.json file which worked (sometimes it didn't, but once it worked for one team-member, using the same package-lock.json worked for everyone)
from react-pdf.
@Tim0Cc if you lock the version with either yarn or npm, then you should also re-use the same package manager to unlock or change it. Mixing yarn and npm means both of them will try to lock package versions, and will likely end up locking different versions, causing inconsistencies across installs. If package-lock.json
is what you use now, you might want to delete yarn.lock
.
By the way, it should be sufficient to downgrade to 3.4.2 instead of all the way to 3.1.9 to fix the bold issue.
from react-pdf.
@lecstor I believe the issues you are describing are fixed in #2747.
from react-pdf.
@Mudbill I located the issue and opened #2731 to address the font family regression. This does not include the fontWeight
issue introduced prior to 3.4.2.
from react-pdf.
this also breaks registering fonts like SFMono-Semibold.ttf, it never loads pdf get stuck rendering
@joacub Can you provide an example that works in 3.4.2 but does not work in 3.4.4? This may not be a related issue. I was able to load a SFMono-Semibold font in both 3.4.2 and 3.4.4 fine. Note that I found many SFMono files are an "otf" extension, not "ttf" like you wrote in your message.
from react-pdf.
Last week I updated to 3.4.4, and I got a report from a client saying that all the bold text in all the pdf's were no longer bold. Upon reading up on this thread and others, I believe my problem is the same as this one.
companyName: {
fontWeight: "bold",
fontFamily: "Helvetica-Bold",
},
When applying this className to the text component, the text is not bold. I have tried variants of the above with no luck.
from react-pdf.
this also breaks registering fonts like SFMono-Semibold.ttf, it never loads pdf get stuck rendering
@joacub Can you provide an example that works in 3.4.2 but does not work in 3.4.4? This may not be a related issue. I was able to load a SFMono-Semibold font in both 3.4.2 and 3.4.4 fine. Note that I found many SFMono files are an "otf" extension, not "ttf" like you wrote in your message.
I convert to ttf, the thing is it was working before this update. Don’t know the reason.
from react-pdf.
Last week I updated to 3.4.4, and I got a report from a client saying that all the bold text in all the pdf's were no longer bold. Upon reading up on this thread and others, I believe my problem is the same as this one.
companyName: { fontWeight: "bold", fontFamily: "Helvetica-Bold", },
When applying this className to the text component, the text is not bold. I have tried variants of the above with no luck.
I agree, this looks like the same issue. The fix in #2731 is merged and should be part of the next release.
I convert to ttf, the thing is it was working before this update. Don’t know the reason.
@joacub I wasn't able to reproduce this issue, but maybe the fix in #2731 will fix it. If the next release doesn't fix the issue, it may be worth making a new issue with a code example to reproduce the problem.
from react-pdf.
Last week I updated to 3.4.4, and I got a report from a client saying that all the bold text in all the pdf's were no longer bold. Upon reading up on this thread and others, I believe my problem is the same as this one.
companyName: { fontWeight: "bold", fontFamily: "Helvetica-Bold", },
When applying this className to the text component, the text is not bold. I have tried variants of the above with no luck.
I agree, this looks like the same issue. The fix in #2731 is merged and should be part of the next release.
I convert to ttf, the thing is it was working before this update. Don’t know the reason.
@joacub I wasn't able to reproduce this issue, but maybe the fix in #2731 will fix it. If the next release doesn't fix the issue, it may be worth making a new issue with a code example to reproduce the problem.
Yeah, im waiting for the fix to test, it was working but suddenly stop working, font loads but the render get stuck, never finished, no errors no feedback
from react-pdf.
We recently react-pdf/renderer to our repo
For some team-members, fontFamily: "Helvetica-Bold", get's applied and the result is indeed bold and Helvetica, for some it isn't, for sure not bold, probably not even Helvetica.
Is there a problem for some devices / OS / Hardware / Chrome-Settings / ... ?
OS: macOS (different M-Chips though)
Browser: Chrome
React-pdf version: ^3.4.2
from react-pdf.
We recently react-pdf/renderer to our repo For some team-members, fontFamily: "Helvetica-Bold", get's applied and the result is indeed bold and Helvetica, for some it isn't, for sure not bold, probably not even Helvetica.
Is there a problem for some devices / OS / Hardware / Chrome-Settings / ... ?
OS: macOS (different M-Chips though) Browser: Chrome React-pdf version: ^3.4.2
@Tim0Cc the likely issue is that some of your team is running 3.4.2 while others are running 3.4.4 (the version with the regression). The ^ allows minor upgrades to the packages. If everyone on your team re-install dependencies then everyone should be able to reproduce the issue.
from react-pdf.
@Mudbill unfortunatelly 3.4.2 doesn't render bold.
we were previously using yarn consistently ... switching to npm for installation did the trick to get the fonts bold on v3.1.9 ... so from now on npm until the issue is fixed ...
from react-pdf.
It seems like there are multiple issues related to font rendering. I've managed to get some form of bolding working by copying the fonts and setup from the fontWeights
example in the repo and building and installing the main
branch locally. Unfortunately the behaviour seems rather esoteric to me.
For instance the following markup results in two lines, one regular, and one bold, rather than the expected alternating regular/bold sentences.
<View>
<Text>
Ut irure qui nisi.
<Text style={{ fontWeight: 700, fontFamily: "Roboto" }}>
Tempor enim irure excepteur.
</Text>{" "}
Nulla aliquip est excepteur.
</Text>
<Text>
<Text style={{ fontWeight: 700, fontFamily: "Roboto" }}>
Proident aliquip ea ullamco.
</Text>{" "}
Adipisicing ullamco sit in.
</Text>
</View>
Another example is when you wrap the fontWeights
example in Text tags it eliminates any bolding.
const MyDoc = () => {
return (
<Page style={styles.body}>
<Text>
<Text style={styles.regular}>Regular text</Text>
<Text style={styles.medium}>Medium text</Text>
<Text style={styles.bold}>Bold text</Text>
<Text style={styles.black}>Black text</Text>
</Text>
</Page>
);
};
from react-pdf.
Related Issues (20)
- Copied Quickstart but kept getting this error: Cannot redefine property: BlobProvider
- showToolBar prop doesn't work as intended on FireFox, the toolbar is still being shown
- Conditional render if page is about to break
- Unknown version HOT 3
- Text overflows vertically when trying to render tables HOT 1
- React-PDF does not work anywhere on Next.JS HOT 2
- Vite 5 + React 18 can't render PDFViewer and give blank page in iframe due to custom fonts HOT 4
- Custom font causes infinite pending of `toBlob` HOT 2
- PDFDownloadLink not working using next js HOT 3
- Vulnerability in used pdfjs-dist version HOT 11
- hasOwnProperty undefined HOT 1
- DEFAULT FONTS IS NOT WORKING HOT 9
- Image not loading after webpack & file-loader
- unable to set pdfinstance to null
- PDFDownloadLink not working using Next js HOT 2
- Error when building code for the browser with esbuild - cannot not resolve "fs", "buffer", "stream", "zlib", "path", "url" HOT 1
- compat with react 19 HOT 1
- Cloudflare worker compatibility
- ReferenceError: Buffer is not defined
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-pdf.