Advanced UI customization
Built in React, the WebViewer UI provides a great developer experience for anyone interested in the source code. You can make adjustments of your own, run it to test, and build it to deploy.
Folder structure
src/
apis/ - APIs exposed in myWebViewer.getInstance()
components/ - React components
constants/ - JavaScript or CSS constants
core/ - APIs from the Core
event-listeners/ - Listeners for the Core events
helpers/ - Reused functions
redux/ - Redux files for state managing
hooks/ - Custom React hooksWorking with the public repo in Github
For a better developer experience, we have open sourced the project in Github. It allows you to keep track of your changes better or sync with future versions easier.
Forking and linking
A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project. To fork and sync with Apryse's webviewer-ui repo, follow these steps:
In the top-right corner of the page, click Fork.
Open terminal and navigate to your destination folder.
Run the following:
See Forking a repo for more information.
Switching branches
The default branch of the repo is the latest stable WebViewer version. For example, if the default branch is 7.1, then it means the latest official WebViewer version is 7.1.
You should switch the branch to be the WebViewer version you are currently using for your application. For example, if you are using WebViewer 7.0 then you should switch to the 7.0 branch and modify the code there. If you are using the legacy UI, then you need to switch to legacy/7.0 instead.
Code in the master branch is considered to be experimental and is not safe to be used in production. Generally we don't recommend that you modify the code in the master branch.
Running
To run the project,
Go to your forked
webviewer-uirepoRun
npm installRun
npm run download-webviewerRun
npm start
Building
To build the source files into webviewer-ui.min.js,
Run
npm run build
Syncing the fork
When you want to merge any changes from the original Apryse's webviewer-ui repo, follow these steps:
Open terminal and navigate to the forked
webviewer-uiRun the following:
See Syncing a fork for more information.
Making pull requests
If you want your changes to be implemented into Apryse's webviewer-ui so that they are available in future releases, see Creating a pull request.
Apply changes in your app
After npm run build, copy all the files in the webviewer-ui/build folder to the lib/ui folder in your app. Restart your app and you should see the new changes. You can write a script to automate this process.
Last updated
Was this helpful?