Libraries and Frameworks
Integrations
This guide will show you how to integrate WebViewer Document Viewer & Editor into a React PDF application.
You can also download a ready-to-go sample on GitHub.
Prior to starting, you should have already installed Node and npm.
Get your Apryse trial key.
Apryse collects some data regarding your usage of the SDK for product improvement.
If you wish to continue without data collection, contact us and we will email you a no-tracking trial key for you to get started.
This video teaches you the fundamentals of installing and initializing WebViewer in any web application. If you wish, you may skip this section and proceed to the steps below.
Run the following command in your Terminal or Command Line:
Next we must copy the static assets required for WebViewer to run. The files are located in node_modules/@pdftron/webviewer/public
and must be moved into a location that will be served and publicly accessible. In React, it will be public
folder.
Inside of a GitHub project, we automate the copying of static resources by executing copy-webviewer-files.js.
Import WebViewer into your component.
Create a reference where WebViewer will be placed or mounted.
Inside of useEffect
hook or componentDidMount
lifecycle method initialize WebViewer. Ensure that the path property in the constructor points to where you copied static assets node_modules/@pdftron/webviewer/public
in React public
folder. Add your own license key in place of 'YOUR_LICENSE_KEY'. (If you are logged in, your key is automatically replaced in below code.)
Run the app by running npm start
.
You can now checkout other guides like sharing WebViewer instance across components, how to open your own documents or how to disable certain features.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales