Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
moesjarraf committed Aug 13, 2015
1 parent 49a7b46 commit 39463cd
Showing 1 changed file with 36 additions and 35 deletions.
71 changes: 36 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,50 @@ Embed [PDF.js](https://mozilla.github.io/pdf.js/) into your angular application,
Note that the order of the scripts being included should stay the same as in the example below.
Also note that images, translations and such are being loaded from the `web` folder.

** View **

<!DOCTYPE html ng-app="app" ng-controller="AppCtrl">
<html>
<head>
<title>Angular PDF.js demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- pdfjs dependencies -->
<link rel="stylesheet" href="web/viewer.css"/>
<link rel="resource" type="application/l10n" href="web/locale/locale.properties"/>
<script src="vendor/angular/angular.js"></script>
<script src="vendor/angular-pdfjs/dist/web/l10n.js"></script>
<script src="vendor/angular-pdfjs/dist/build/pdf.js"></script>
<script src="vendor/angular-pdfjs/dist/build/pdf.worker.js"></script>
<script src="vendor/angular-pdfjs/dist/web/compatibility.js"></script>
<script src="vendor/angular-pdfjs/dist/web/debugger.js"></script>
<script src="vendor/angular-pdfjs/dist/web/viewer.js"></script>

<!-- the directive -->
<script src="vendor/angular-pdfjs/dist/pdfjs-viewer.js"></script>
</head>
<body>
<pdfjs-viewer src="{{ pdf.src }}"></pdfjs-viewer>
</body>
</html>
**View**
```html
<!DOCTYPE html ng-app="app" ng-controller="AppCtrl">
<html>
<head>
<title>Angular PDF.js demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- pdfjs dependencies -->
<link rel="stylesheet" href="web/viewer.css"/>
<link rel="resource" type="application/l10n" href="web/locale/locale.properties"/>
<script src="vendor/angular/angular.js"></script>
<script src="vendor/angular-pdfjs/dist/web/l10n.js"></script>
<script src="vendor/angular-pdfjs/dist/build/pdf.js"></script>
<script src="vendor/angular-pdfjs/dist/build/pdf.worker.js"></script>
<script src="vendor/angular-pdfjs/dist/web/compatibility.js"></script>
<script src="vendor/angular-pdfjs/dist/web/debugger.js"></script>
<script src="vendor/angular-pdfjs/dist/web/viewer.js"></script>

<!-- the directive -->
<script src="vendor/angular-pdfjs/dist/pdfjs-viewer.js"></script>
</head>
<body>
<pdfjs-viewer src="{{ pdf.src }}"></pdfjs-viewer>
</body>
</html>
```

The directive takes the following optional attributes to modify the toolbar

download="false" print="false" open="false"

Omitting these attributes will by default show the options in the toolbar.

** Controller **

angular.module('app', ['pdfjs']);

angular.module('app').controller('AppCtrl', function($scope) {
$scope.pdf = {
src: 'demo/example.pdf'
};
});
**Controller**
```js
angular.module('app', ['pdfjs']);

angular.module('app').controller('AppCtrl', function($scope) {
$scope.pdf = {
src: 'demo/example.pdf'
};
});
```

## Demo

Expand Down

0 comments on commit 39463cd

Please sign in to comment.