Some test text!

Advanced customization

In this document
chevron_rightFolder structure
chevron_rightRunning
chevron_rightBuilding
chevron_rightWorking with the public repo in Github
chevron_rightForking and linking
chevron_rightSyncing the fork
chevron_rightMaking pull requests

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.

linkFolder 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

linkRunning

To run the project,

  1. Go to lib/ui/
  2. Run npm install
  3. Run npm start

linkBuilding

To build the source files into webviewer-ui.min.js,

  1. Run npm run build

linkWorking 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.

linkForking 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 PDFTron's webviewer-ui repo, follow these steps:

  1. Go to https://github.com/PDFTron/webviewer-ui.
  2. In the top-right corner of the page, click Fork.
  3. Open terminal and navigate to WebViewer/lib/ui
  4. Run the following:

    git init && git remote add origin https://github.com/YOUR-USERNAME/webviewer-ui && git fetch origin master && git reset origin/master && git remote add upstream https://github.com/PDFTron/webviewer-ui

See Forking a repo for more information.

linkSyncing the fork

When you want to merge any changes from the original PDFTron's webviewer-ui repo, follow these steps:

  1. Open terminal and navigate to WebViewer/lib/ui
  2. Run the following:

    git fetch upstream master && git checkout master && git merge upstream/master

See Syncing a fork for more information.

linkMaking pull requests

If you want your changes to be implemented into PDFTron's webviewer-ui so that they are available in future releases, see Creating a pull request.