Skip to content

Commit 8e31db5

Browse files
committed
Fix some broken PDFJs references
1 parent 7fb3731 commit 8e31db5

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

sandbox/basic/index.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ import annotations from './annotations';
33

44
const DOCUMENT_ID = 'PDFJSAnnotate.pdf';
55

6-
PDFJS.workerSrc = '../shared/pdf.worker.js';
6+
pdfjsViewer.workerSrc = '../shared/pdf.worker.js';
77

88
PDFJSAnnotate.StoreAdapter.getAnnotations = (documentId, pageNumber) => {
99
return new Promise((resolve, reject) => {
1010
resolve(annotations);
1111
});
1212
};
1313

14-
PDFJS.getDocument(DOCUMENT_ID).then((pdf) => {
14+
pdfjsViewer.getDocument(DOCUMENT_ID).then((pdf) => {
1515
Promise.all([
1616
pdf.getPage(1),
1717
PDFJSAnnotate.getAnnotations(1)
18-
])
19-
.then(([page, annotations]) => {
18+
]).then(([page, annotations]) => {
2019
data.page = page;
2120
data.annotations = annotations;
2221
render();
@@ -38,7 +37,7 @@ function render() {
3837
let canvas = document.getElementById('canvas');
3938
let svg = document.getElementById('svg');
4039
let canvasContext = canvas.getContext('2d');
41-
40+
4241
canvas.height = viewport.height;
4342
canvas.width = viewport.width;
4443
canvas.style.marginTop = ((viewport.height / 2) * -1) + 'px';

web/index.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const documentId = 'example.pdf';
77
const userId = 'testUser';
88
let PAGE_HEIGHT;
99
let RENDER_OPTIONS = {
10-
documentId,
11-
userId: 'testUser',
10+
documentId: documentId,
11+
userId: userId,
1212
pdfDocument: null,
1313
scale: parseFloat(localStorage.getItem(`${documentId}/scale`), 10) || 1.33,
1414
rotate: parseInt(localStorage.getItem(`${documentId}/rotate`), 10) || 0
@@ -46,7 +46,6 @@ function render() {
4646

4747
let viewer = document.getElementById('viewer');
4848
viewer.innerHTML = '';
49-
console.log(pdf);
5049
NUM_PAGES = pdf.numPages;
5150
for (let i = 0; i < NUM_PAGES; i++) {
5251
let page = UI.createPage(i + 1);
@@ -62,7 +61,7 @@ function render() {
6261
render();
6362

6463
// Hotspot color stuff
65-
(function () {
64+
(function() {
6665
let hotspotColor = localStorage.getItem(`${RENDER_OPTIONS.documentId}/hotspot/color`) || 'darkgoldenrod';
6766
let currentTarget = undefined;
6867

@@ -90,7 +89,7 @@ render();
9089
}
9190
}
9291

93-
initColorPicker(document.querySelector('.hotspot-color'), hotspotColor, function (value) {
92+
initColorPicker(document.querySelector('.hotspot-color'), hotspotColor, function(value) {
9493
if (value === hotspotColor) {
9594
return; // nothing to do
9695
}
@@ -126,7 +125,7 @@ render();
126125
})();
127126

128127
// Text stuff
129-
(function () {
128+
(function() {
130129
let textSize;
131130
let textColor;
132131

0 commit comments

Comments
 (0)