Skip to content

Commit

Permalink
cherry pick from #2
Browse files Browse the repository at this point in the history
  • Loading branch information
maggievu-pdftron committed Nov 6, 2024
1 parent 5588097 commit a4eac42
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 30 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Copyright 2018 PDFTron Systems Inc. All rights reserved.
WebViewer React UI project/codebase or any derived works is only permitted in solutions with an active commercial PDFTron WebViewer license. For exact licensing terms please refer to your commercial WebViewer license. For use in other scenario, please contact sales@pdftron.com
Copyright 2023 Apryse Software Inc. All rights reserved.
WebViewer React UI project/codebase or any derived works is only permitted in solutions with an active commercial Apryse WebViewer license. For exact licensing terms refer to your commercial WebViewer license. For use in other scenario, contact sales@apryse.com.
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# WebViewer - AngularJS sample

[WebViewer](https://www.pdftron.com/webviewer) is a powerful JavaScript-based PDF Library that's part of the [PDFTron PDF SDK](https://www.pdftron.com). It provides a slick out-of-the-box responsive UI that interacts with the core library to view, annotate and manipulate PDFs that can be embedded into any web project.
[WebViewer](https://www.pdftron.com/webviewer) is a powerful JavaScript-based PDF Library that is part of the [Apryse SDK](https://www.pdftron.com). It provides a slick out-of-the-box responsive UI that interacts with the core library to view, annotate, and manipulate PDFs that can be embedded into any web project.

![WebViewer UI](https://www.pdftron.com/downloads/pl/webviewer-ui.png)

This repo is specifically designed for any users interested in integrating WebViewer into AngularJS project. See [AngularJS.org](https://angularjs.org) for more information.
This repo is specifically designed for any users interested in integrating WebViewer into [AngularJS](https://angularjs.org).

## Initial setup

Before you begin, make sure your development environment includes [Node.js](https://nodejs.org/en/).
Before you begin, make sure your development environment includes:

1. [Node.js](https://nodejs.org/en).
2. IDE used in this sample is Visual Studio Code.
3. [GitHub command line](https://github.com/git-guides/install-git) `git`.
4. Angular CLI: `npm install -g @angular/cli`. If an unsupported engine message appears, make sure to install a compatible NodeJS version.

## Install

```
git clone https://github.com/PDFTron/webviewer-angularjs-sample.git
gh repo clone ApryseSDK/webviewer-angularjs-sample
cd webviewer-angularjs-sample
npm install
```
Expand All @@ -26,13 +31,9 @@ npm start

Navigate to `http://localhost:3000/`. The app will automatically reload if you change any of the source files.

## WebViewer APIs

See [API documentation](https://www.pdftron.com/documentation/web/guides/ui/apis).

## Enabling full API

PDFNetJS Full is a complete browser side PDF SDK, unlocking viewing, parsing and editing of PDF files. To enable full API, you can modify constructor in components.js:
Webviewer Full API is a complete browser side PDF SDK, unlocking viewing, parsing and editing of PDF files. To enable full API, you can modify constructor in components.js:

```diff
WebViewer({
Expand All @@ -42,13 +43,22 @@ WebViewer({
}, document.getElementById('viewer'))
```

You can refer to this [guide for more information](https://www.pdftron.com/documentation/web/guides/full-api)
Visit Apryse's [WebViewer](https://docs.apryse.com/documentation/web/) page to see what else you can do with the WebViewer.

## WebViewer APIs

* [@pdftron/webviewer API documentation](https://docs.apryse.com/api/web/global.html#WebViewer__anchor)
* [@pdftron/webviewer-angularjs](https://github.com/ApryseSDK/webviewer-angularjs-sample)

## Showcase

Refer to a running sample on Apryse SDK [showcase page](https://showcase.apryse.com/).

## Contributing

See [contributing](./CONTRIBUTING.md).
Any submission to this repo is governed by these [guidelines](/CONTRIBUTING.md).


## License

See [license](./LICENSE).
![](https://onepixel.pdftron.com/webviewer-angularjs-sample)
For licensing, refer to [License](LICENSE).
24 changes: 12 additions & 12 deletions app/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ angular.module('components', [])
initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf',
// initialDoc: '/path/to/my/file.pdf', // You can also use documents on your server
}, document.getElementById('viewer'))
.then(function(instance) {
const docViewer = instance.Core.documentViewer;
const annotManager = instance.Core.annotationManager;
// call methods from instance, docViewer and annotManager as needed
.then(function(instance) {
const docViewer = instance.Core.documentViewer;
const annotManager = instance.Core.annotationManager;
// call methods from instance, docViewer and annotManager as needed

// you can also access major namespaces from the instance as follows:
// const Tools = instance.Core.Tools;
// const Annotations = instance.Core.Annotations;
// you can also access major namespaces from the instance as follows:
// const Tools = instance.Core.Tools;
// const Annotations = instance.Core.Annotations;

// change to dark theme
instance.UI.setTheme('dark');
// change to dark theme
instance.UI.setTheme('dark');

docViewer.addEventListener('documentLoaded', function() {
// call methods relating to the loaded document
docViewer.addEventListener('documentLoaded', function() {
// call methods relating to the loaded document
});
});
});
},
template: "<div id='viewer' style='width: 100%; height: 100%; margin: 0 auto;'></div>",
replace: true
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"postinstall": "node tools/copy-webviewer-files.js"
},
"devDependencies": {
"body-parser": "1.18.3",
"express": "^4.16.3",
"body-parser": "^1.20.3",
"express": "^4.21.0",
"morgan": "^1.9.1",
"supervisor": "0.12.0",
"fs-extra": "^9.0.0",
"fs-extra": "^11.2.0",
"@pdftron/webviewer": "^11.0.0"
},
"repository": {
Expand Down

0 comments on commit a4eac42

Please sign in to comment.