Unable to use `@react-pdf/renderer` with next14
Unanswered
Naeemgg posted this in #help-forum
20 Replies
NaeemggOP
its just a simple PDF with nothing fancy in it. it has some texts, links and a qrcode
@Naeemgg getting this error
remove the @react-pdf/renderer from your external packages list. If it's not there, import the component as client component. If the error still persists import the client component without SSR (lazy loading)
@B33fb0n3 remove the @react-pdf/renderer from your external packages list. If it's not there, import the component as client component. If the error still persists import the client component without SSR (lazy loading)
NaeemggOP
already importing like this
import React from 'react'
import dynamic from "next/dynamic";
const PdfGenerator = dynamic(() => import("@/app/components/React-PDF"), { ssr: false });
const page = () => {
return (
<div>
<PdfGenerator />
</div>
)
}
export default page
still the issue is there
@Naeemgg it was in external packages, removed it
remove it everywhere where external packages are. Then delete the .next folder and restart your app
NaeemggOP
let me try
@B33fb0n3 remove it everywhere where external packages are. Then delete the .next folder and restart your app
NaeemggOP
in
next start
its working finebut in dev its giving the same error
@Naeemgg but in dev its giving the same error
did you restarted your dev server?
@B33fb0n3 did you restarted your dev server?
NaeemggOP
multiple times
deleted
.next
as welland you also remove it from the dev external packages (if they exists)?
NaeemggOP
YEPP
I think I should roll back to
jsPdf
I just wanted to try other pdf libraries
while jspdf is working just fine the margin,border,padding and these things are very time consuming
yea, it looks like react-pdf is more a library for react only... and haven't been configured to work for other versions as well..
NaeemggOP
I wanted to write once and use it for both web and PDF