Skip to content

Example of how to do client-side PDF rendering in a React app.

License

Notifications You must be signed in to change notification settings

BenJetson/pdf-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Test

This project shows examples for how to do client-side PDF rendering in a React app.

You can see it live at https://pdf-test-sample.vercel.app.

Homepage MUI View Generic View
Homepage Screenshot MUI PDF Generation Screenshot Generic PDF Generation Screenshot

Under the Hood

This project uses the jspdf-html2canvas library to generate PDF documents on the client.

If you are interested in doing something similar in your app, take a look at src/components/ReportGenerator.js.

You can write your own custom views for ReportGenerator as well. Two example views are provided:

Limitations

  • jspdf-html2canvas generates PDF documents by converting the output to an image. Thus, text is not selectable in the output.
  • Due to CORS, external images cannot be rendered in the PDF documents. For more info, read the info in the Vivid Report example.