I know this happens when I register a new font and create some pdfs on the page. When the font is standard, the error disappears, but I need Polish characters łść, etc.
This is my simplified code:
MyDocument
import { Page, Text, View, Document, StyleSheet, Font } from '@react-pdf/renderer';
Font.register({
family: "Roboto",
src:
"https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-light-webfont.ttf"
});
const styles = StyleSheet.create({
page: {
flexDirection: 'row',
backgroundColor: '#ffffff',
fontFamily: "Roboto"
},
section: {
margin: 10,
padding: 10,
},
});
const MyDocument = ({number,owner, title, charge, term, account}) => (
<Document>
<Page size="A4" style={styles.page} >
<View style={styles.section}>
<Text>Tytuł: {title}</Text>
</View>
</Page>
</Document>
)
import MyDocument from './pdf.jsx';
// (...)
const FinancesTable = finances.map((finance, index) => {
const { _id, allotment_number,owner, title, area, charge, term, status, account } = finance;
return (
<tr key={_id}>
<td>{allotment_number}</td>
<td>{title}</td>
<td>{area} m²</td>
<td>{charge} zł</td>
<td>{term}</td>
<td>{status}</td>
<td>
<PDFDownloadLink
document={MyDocument({ number: allotment_number,
owner: this.props.auth.user.firstname+ ' '+this.props.auth.user.lastname,
title: title,
charge: charge,
term: term,
account: account,
}) }
fileName="faktura.pdf">
{({ blob, url, loading, error }) => (loading ? 'Ładowanie...' : <Button style={BlueButtonStyle}>Pobierz</Button>)}
</PDFDownloadLink></td>
</tr>
);
// (...)
return <tbody>{FinancesTable}</tbody>
Polish characters work for the first item on the arrays, the next one is "Loading ..."