Reputation: 23
I have a problem with changing fonts in react-pdf.
// Register Font
Font.register({
family: "Roboto",
src:
"https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-light-webfont.ttf"
});
So by default with font register is given Roboto font, but I need a Public Sans font and nowhere I can find source of it. Any help would be great
Upvotes: 1
Views: 4428
Reputation: 124
try to download the font ttf file and import it and assign to scr.
enter code here
import roboto from './Roboto-Regular.ttf'
Font.register({ family: 'Roboto', fonts: [ { src: roboto , fontWeight: 'bold' } ] })
Upvotes: 1