Generate PDF in Persian with @react-pdf/renderer

Viewed 39

I have problem with displaying Persian text on a PDF file. while rendering the component it works fine but when saving it as a PDF file it shows dummy text.

how it displays on webpage

enter image description here

and when downloaded

enter image description here

My code:

import font from "./IRANsans.ttf";

Font.register({
  family: "IRANSans",
  format: "truetype",
  src: font,
});

const styles = StyleSheet.create({
  page: {
    fontFamily: "IRANSans",
  },


<Document style={{ backgroundColor: "white", padding: "10px" }}>
    <Page size="A4" style={styles.page}>
      <View >
        <Text>متن نوشته شده به فارسی</Text>
      </View>
    </Page>
  </Document>

any solution or suggestion? thanks

0 Answers
Related