simple-react-pdf-service v1.0.1
Description
This is Simple PDF React service example with Express server.
The idea behind this module is to read the pdf file on the server side, where You have access to it and send it to the client. The client read the pdf, parse it and creates React component for You in Your browser. This is how it goes, generally.
This example uses my simple-react-pdf module and shows how to use it in the client-server architecture avoiding the Cross-Origin Resource Sharing (CORS) issue. Server has been built with Babel and Client is transformed with Browserify to be readable by browsers.
Feel free to use it as the idea-template for Your real-life applications.
Screenshot
Screenshot example (3 x Simple PDF React component):
Install
npm install simple-react-pdf-service
However, in production or if you do not plan to re-build it, do not install devDependencies. See npm documentation page.
Usage - quickstart
cd node_modules/simple-react-pdf-service
npm run start-server
in other terminal window:
npm run test-firefox
Usage - other browsers
Available shorcuts for browsers:
npm run test-firefox
npm run test-chrome
npm run test-opera
If You want to test the client in Your other favorite browser, just go to the client folder:
cd node_modules/simple-react-pdf-service/client
and open index.html file in Your favorite browser.
Re-build
After making Your own changes just go to module folder (if you are not there already):
cd node_modules/simple-react-pdf-service
and run command:
npm run build
This should download all packages and build everything again. Should work :-)
License
MIT
7 years ago