NUTRIENT DOCS
NUTRIENT DOCS
DOCS
Web
Get Started
REACT
EXISTING PROJECT
Web SDK
When only using Web SDK, our JavaScript library renders and edits documents directly in the browser. It’s
powered by WebAssembly technology, and it doesn’t require a server, plugins, or internet access, making it
secure, fast, and suitable for offline use.
https://www.nutrient.io/getting-started/web/?frontend=react&project=existing-project 1/5
21/02/2025, 23:26 Getting started on Web | Nutrient
Reduced infrastructure costs — Rendering and processing are handled on the client-side, lowering
server expenses.
Privacy by design — Documents remain on the client’s machine, avoiding network transfers and
minimizing data exposure risks.
YARN NPM
2 Copy the PSPDFKit for Web library assets to the public directory:
cp -R ./node_modules/pspdfkit/dist/pspdfkit-lib public/pspdfkit-lib
3 Make sure your public directory contains a pspdfkit-lib directory with the PSPDFKit
library assets.
4 Make sure your server has the Content-Type: application/wasm MIME typeset. Read more
about this in the troubleshooting section.
2 Displaying a PDF
1 Rename the PDF document you want to display in your application to document.pdf , and place it
in the public directory. You can use this demo document as an example.
2 In the src/components/ folder, create the PdfViewerComponent.js file with the following
content. This adds a component wrapper for the PSPDFKit library:
https://www.nutrient.io/getting-started/web/?frontend=react&project=existing-project 2/5
21/02/2025, 23:26 Getting started on Web | Nutrient
The PUBLIC_URL variable is used to reference assets in your public/ folder. Your project might not
have the process.env.PUBLIC_URL variable set. You can set it before building the project:
3 In your app, add the following below the lines beginning with import . This includes the newly
created component in your app:
DocumentViewerComponent()
YARN NPM
1 yarn start
Next Steps
Check out the full React example.
Explore real-world applications — See how others are using our tools! Discover common use cases
and get inspiration for your own projects. View the example project.
Troubleshooting made easy — Encountered a bump in the road? We’ve got you covered. Find
solutions in the troubleshooting guide.
Build a supercharged PWA — Want to create a progressive web app (PWA) with our SDK? Our
comprehensive PWA guide provides step-by-step instructions to get you started.
YES NO
Questions? Contact us
https://www.nutrient.io/getting-started/web/?frontend=react&project=existing-project 5/5