Skip to content

Commit a18caa7

Browse files
committed
Adds gulp dist-install command; using pdfjs-dist package in examples.
1 parent 9342054 commit a18caa7

File tree

24 files changed

+70
-53
lines changed

24 files changed

+70
-53
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ The repository contains a hello world example that you can run locally:
104104

105105
+ [examples/helloworld/](https://github.com/mozilla/pdf.js/blob/master/examples/helloworld/)
106106

107+
More examples can be found at the examples folder. Some of them are using the pdfjs-dist package, which can be built and installed in this repo directory via `gulp dist-install` command.
108+
107109
For an introduction to the PDF.js code, check out the presentation by our
108110
contributor Julian Viereck:
109111

examples/acroforms/acroforms.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
<title>AcroForms example</title>
2222

23-
<link rel="stylesheet" href="../../build/dist/web/pdf_viewer.css">
23+
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css">
2424

25-
<script src="../../build/dist/build/pdf.js"></script>
26-
<script src="../../build/dist/web/pdf_viewer.js"></script>
25+
<script src="../../node_modules/pdfjs-dist/build/pdf.js"></script>
26+
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.js"></script>
2727

2828
<style>
2929
* {

examples/acroforms/acroforms.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
'use strict';
1717

18-
PDFJS.workerSrc = '../../build/dist/build/pdf.worker.js';
18+
PDFJS.workerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.js';
1919

2020
var DEFAULT_URL = '../../test/pdfs/f1040.pdf';
2121
var DEFAULT_SCALE = 1.0;

examples/browserify/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Example to demonstrate PDF.js library usage with Browserify.
66

77
Build project and install the example dependencies:
88

9-
$ gulp dist
9+
$ gulp dist-install
1010
$ cd examples/browserify
1111
$ npm install
1212

examples/browserify/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"gulp-rename": "^1.2.2",
88
"gulp-streamify": "^1.0.2",
99
"gulp-uglify": "^1.5.3",
10-
"pdfjs-dist": "../../build/dist",
10+
"pdfjs-dist": "../../node_modules/pdfjs-dist",
1111
"vinyl-source-stream": "^1.1.0"
1212
},
1313
"scripts": {

examples/components/pageviewer.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
}
3030
</style>
3131

32-
<link rel="stylesheet" href="../../build/dist/web/pdf_viewer.css">
32+
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css">
3333

34-
<script src="../../build/dist/build/pdf.js"></script>
35-
<script src="../../build/dist/web/pdf_viewer.js"></script>
34+
<script src="../../node_modules/pdfjs-dist/build/pdf.js"></script>
35+
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.js"></script>
3636
</head>
3737

3838
<body tabindex="1">

examples/components/pageviewer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
if (!PDFJS.PDFViewer || !PDFJS.getDocument) {
1919
alert('Please build the pdfjs-dist library using\n' +
20-
' `gulp dist`');
20+
' `gulp dist-install`');
2121
}
2222

2323
// The workerSrc property shall be specified.
2424
//
25-
PDFJS.workerSrc = '../../build/dist/build/pdf.worker.js';
25+
PDFJS.workerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.js';
2626

2727
// Some PDFs need external cmaps.
2828
//
29-
// PDFJS.cMapUrl = '../../build/dist/cmaps/';
29+
// PDFJS.cMapUrl = '../../node_modules/pdfjs-dist/cmaps/';
3030
// PDFJS.cMapPacked = true;
3131

3232
var DEFAULT_URL = '../../web/compressed.tracemonkey-pldi-09.pdf';

examples/components/simpleviewer.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
}
3636
</style>
3737

38-
<link rel="stylesheet" href="../../build/dist/web/pdf_viewer.css">
38+
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css">
3939

40-
<script src="../../build/dist/build/pdf.js"></script>
41-
<script src="../../build/dist/web/pdf_viewer.js"></script>
40+
<script src="../../node_modules/pdfjs-dist/build/pdf.js"></script>
41+
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.js"></script>
4242
</head>
4343

4444
<body tabindex="1">

examples/components/simpleviewer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
if (!PDFJS.PDFViewer || !PDFJS.getDocument) {
1919
alert('Please build the pdfjs-dist library using\n' +
20-
' `gulp dist`');
20+
' `gulp dist-install`');
2121
}
2222

2323
// The workerSrc property shall be specified.
2424
//
25-
PDFJS.workerSrc = '../../build/dist/build/pdf.worker.js';
25+
PDFJS.workerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.js';
2626

2727
// Some PDFs need external cmaps.
2828
//
29-
// PDFJS.cMapUrl = '../../build/dist/cmaps/';
29+
// PDFJS.cMapUrl = '../../node_modules/pdfjs-dist/cmaps/';
3030
// PDFJS.cMapPacked = true;
3131

3232
var DEFAULT_URL = '../../web/compressed.tracemonkey-pldi-09.pdf';

examples/helloworld/hello.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
'use strict';
22

33
// In production, the bundled pdf.js shall be used instead of SystemJS.
4-
Promise.all([SystemJS.import('pdfjs/display/api'),
5-
SystemJS.import('pdfjs/display/global')])
4+
Promise.all([System.import('pdfjs/display/api'),
5+
System.import('pdfjs/display/global'),
6+
System.resolve('pdfjs/worker_loader')])
67
.then(function (modules) {
78
var api = modules[0], global = modules[1];
89
// In production, change this to point to the built `pdf.worker.js` file.
9-
global.PDFJS.workerSrc = '../../src/worker_loader.js';
10+
global.PDFJS.workerSrc = modules[2];
1011

1112
// Fetch the PDF document from the URL using promises.
1213
api.getDocument('helloworld.pdf').then(function (pdf) {

0 commit comments

Comments
 (0)