Describe the bug I develop a PDFfile and display those PDFfile by using PdfViewer on a page. When I develop on a local, it works well. But When I build a page, PDFViwer and any Pdf don't display. I don't know how to fix this. In the production page, created pdf doesn't appear, but in the local, all pdf works well....
To Reproduce
//temp.tsx
import React, { useState } from "react";
import TempPDF from "../../src/components/printBarcode/temp";
const index = () => {
return <TempPDF />;
};
export default index;
import React, { useEffect, useState } from "react";
import dynamic from "next/dynamic";
import TempDocument from "./TempDocument";
const PDFViewer = dynamic(
import("@react-pdf/renderer").then((module) => module.PDFViewer),
{
loading: ({ error, isLoading, pastDelay, retry }) => {
return <div>{isLoading}</div>;
},
ssr: false,
}
);
function TempPDF() {
return (
<div>
<PDFViewer
//@ts-ignore
width="100%"
height="660px"
>
<TempDocument />
</PDFViewer>
</div>
);
}
export default TempPDF;
import React from "react";
import {
Document,
Font,
Page,
View,
StyleSheet,
Text,
} from "@react-pdf/renderer";
Font.register({
family: "Nanum Gothic",
fonts: [
{ src: "/static/font/NanumGothic.ttf" },
{ src: "/static/font/NanumGothic-Bold.ttf", fontWeight: "bold" },
],
});
const TempDocument = () => {
const styles = StyleSheet.create({});
return (
<Document>
<Page wrap={false} break size={[80, 60]}>
<View>
<Text>Please display</Text>
</View>
</Page>
</Document>
);
};
export default TempDocument;
- OS: [MacOS]
- Browser [chrome]
- React-pdf version [^2.1.1]
- vercel