diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
14.92k stars 1.18k forks source link

PDFViewer component in Next.js renders blank page when using custom fonts from local project #2302

Open aaqibrasool opened 1 year ago

aaqibrasool commented 1 year ago

Describe the bug When attempting to use custom fonts from my local project in the PDFViewer component of react-pdf within a Next.js application, the rendered page appears blank with no content.

To Reproduce Steps to reproduce the behavior including code snippet (if applies): 1- Create a Next.js project. 2- Import and register a custom font from the local project using Font.register. 3- Apply the custom font to the PDFViewer component or any text element within it. 4- Render the PDFViewer component in a Next.js page. 5- Notice that the rendered page is blank with no visible content.

Expected behavior The PDFViewer component in the Next.js application should render the content with the applied custom font correctly, displaying the text using the specified font.

Screenshots image

Desktop (please complete the following information):

MGorgas commented 1 year ago

I had the same issue. Updating nextjs to the latest version (13+) fixed this problem. See: next/font

AMATEURTOSS commented 7 months ago

is there any solution for this issue?

thinhbg2812-2 commented 5 months ago

With next 14.0.1 i got same issue, the pdf load success but it's display blank

CleanShot 2024-06-07 at 14 36 38