This is a simple example of using PdfKit with React (bootstrapped with Create React App).
It is based on pdfkit-webpack-example
.
react-ace
is used for the in-browser code editting.customize-cra
is used to modify the webpack configuration so that assets like fonts and images can be imported in all the ways found inpdfkit-webpack-example
. These customizations can be found inconfig-overrides.js
.- The initial PDF content code (
makePDF
function) has been moved into its own file (src/makePDF.js
) so that it can be loaded separately and avoid having its formatting disrupted by Webpack/Babel.
The first time: in the project directory, run npm install
.
Then run npm start
to start the app in development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.