Could not resolve font for Arial,Helvetica,sans-serif, fontWeight 400. error in react-pdf/renderer library

234 Views Asked by At

react-pdf/renderer library throws error Could not resolve font for Arial,Helvetica,sans-serif, fontWeight 400

i'm getting this error only in production environment in local environment it is working fine.

also i can't find the CDN or font file for font family "Arial,Helvetica,sans-serif", is this possible if i give a name of another font family and CDN of another font family in Font.register method.

here is my code snippet.

Font.register({
  family: 'Arial,Helvetica,sans-serif',
  src: "https://fonts.googleapis.com/css2?family=Roboto&display=swap",
  fontWeight: '400',
  fontStyle: 'bold',
  format: 'truetype',
});
const styles = StyleSheet.create({
container: {
  display: "flex",
  flexDirection: 'row',
  borderBottomColor: borderColor,
  backgroundColor: borderColor,
  borderBottomWidth: 1,
  alignItems: 'center',
  alignContent: 'center',
  height: 24,
  textAlign: 'left',
  fontStyle: 'bold',
  fontWeight: '400',
  flexGrow: 1,
  
},
});
0

There are 0 best solutions below