Reputation: 5001
When button clicked reactPdf.render called and it throws the exception pic as below;
Expected Behaviour: Download a file name "example.pdf"
import ReactPDF from "@react-pdf/renderer";
const GenerateBarcode = () => {
ReactPDF.render(<p>Some Jsx Elements</p>, `${__dirname}/example.pdf`);
};
return (
<div>
<button
className="btn btn-primary "
type="button"
onClick={GenerateBarcode}
>
Generator PDF
</button>
...
Upvotes: 0
Views: 322
Reputation: 621
solution: https://github.com/diegomura/react-pdf/issues/283#issuecomment-412233870
Basically you are using a node
lib in the web environment
as the comment states.
Upvotes: 2