This is a code repository for the corresponding article on Medium.
In this tutorial, you will learn how to generate dynamic PDFs using HTML code as a template.
- Create a new directory
mkdir pdfGenerator && cd pdfGenerator
- Create a new React App with
create-react-app client
and then move into newly created directory and install dependenciescd client && npm i -S axios file-saver
- Create an Express server with
mkdir server && cd server && touch index.js && npm init
press enter a couple of times to initialize package.json and then runnpm i -S express body-parser cors html-pdf
to save all the necessary dependencies. - Add proxy inside of client/package.json, above the dependencies, simply add
“proxy”: “http://localhost:5000/"
, so you can call the localhost from the client. - Open two different terminals:
First one: go into the client directory and
run npm start
Second one: go into the server directory andrun nodemon index.js