To align with your React version 18, ensure that you upgrade to the latest version of react-pdf. For React versions 16.8 and above, it is recommended to use the most recent version of react-pdf.
NOTE:
Determine the recommended React-PDF version based on your React version.
By specifying renderMode=”svg”, you instruct react-pdf to utilize SVG mode for PDF rendering. SVG rendering typically consumes less memory than canvas rendering.
<Document file={pdfBlob} onLoadSuccess={onDocumentLoadSuccess} renderMode="svg" // Set render mode to SVG // Other props... > {/* Other components... */} </Document>
Moreover, it is recommended to compress large PDFs or those containing image-heavy content to avoid potential errors caused by extended loading times.