|
|
@ -1362,13 +1362,14 @@ var PDFPageView = function PDFPageViewClosure() { |
|
|
|
getPagePoint: function PDFPageView_getPagePoint(x, y) { |
|
|
|
getPagePoint: function PDFPageView_getPagePoint(x, y) { |
|
|
|
return this.viewport.convertToPdfPoint(x, y); |
|
|
|
return this.viewport.convertToPdfPoint(x, y); |
|
|
|
}, |
|
|
|
}, |
|
|
|
draw: function PDFPageView_draw() { |
|
|
|
draw: function draw() { |
|
|
|
|
|
|
|
var _this = this; |
|
|
|
|
|
|
|
|
|
|
|
if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { |
|
|
|
if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { |
|
|
|
console.error('Must be in new state before drawing'); |
|
|
|
console.error('Must be in new state before drawing'); |
|
|
|
this.reset(); |
|
|
|
this.reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; |
|
|
|
this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; |
|
|
|
var self = this; |
|
|
|
|
|
|
|
var pdfPage = this.pdfPage; |
|
|
|
var pdfPage = this.pdfPage; |
|
|
|
var div = this.div; |
|
|
|
var div = this.div; |
|
|
|
var canvasWrapper = document.createElement('div'); |
|
|
|
var canvasWrapper = document.createElement('div'); |
|
|
@ -1380,10 +1381,9 @@ var PDFPageView = function PDFPageViewClosure() { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
div.appendChild(canvasWrapper); |
|
|
|
div.appendChild(canvasWrapper); |
|
|
|
} |
|
|
|
} |
|
|
|
var textLayerDiv = null; |
|
|
|
|
|
|
|
var textLayer = null; |
|
|
|
var textLayer = null; |
|
|
|
if (this.textLayerFactory) { |
|
|
|
if (this.textLayerFactory) { |
|
|
|
textLayerDiv = document.createElement('div'); |
|
|
|
var textLayerDiv = document.createElement('div'); |
|
|
|
textLayerDiv.className = 'textLayer'; |
|
|
|
textLayerDiv.className = 'textLayer'; |
|
|
|
textLayerDiv.style.width = canvasWrapper.style.width; |
|
|
|
textLayerDiv.style.width = canvasWrapper.style.width; |
|
|
|
textLayerDiv.style.height = canvasWrapper.style.height; |
|
|
|
textLayerDiv.style.height = canvasWrapper.style.height; |
|
|
@ -1398,10 +1398,10 @@ var PDFPageView = function PDFPageViewClosure() { |
|
|
|
var renderContinueCallback = null; |
|
|
|
var renderContinueCallback = null; |
|
|
|
if (this.renderingQueue) { |
|
|
|
if (this.renderingQueue) { |
|
|
|
renderContinueCallback = function renderContinueCallback(cont) { |
|
|
|
renderContinueCallback = function renderContinueCallback(cont) { |
|
|
|
if (!self.renderingQueue.isHighestPriority(self)) { |
|
|
|
if (!_this.renderingQueue.isHighestPriority(_this)) { |
|
|
|
self.renderingState = _pdf_rendering_queue.RenderingStates.PAUSED; |
|
|
|
_this.renderingState = _pdf_rendering_queue.RenderingStates.PAUSED; |
|
|
|
self.resume = function resumeCallback() { |
|
|
|
_this.resume = function () { |
|
|
|
self.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; |
|
|
|
_this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; |
|
|
|
cont(); |
|
|
|
cont(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1410,27 +1410,27 @@ var PDFPageView = function PDFPageViewClosure() { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
var finishPaintTask = function finishPaintTask(error) { |
|
|
|
var finishPaintTask = function finishPaintTask(error) { |
|
|
|
if (paintTask === self.paintTask) { |
|
|
|
if (paintTask === _this.paintTask) { |
|
|
|
self.paintTask = null; |
|
|
|
_this.paintTask = null; |
|
|
|
} |
|
|
|
} |
|
|
|
if (error === 'cancelled' || error instanceof _pdfjs.RenderingCancelledException) { |
|
|
|
if (error === 'cancelled' || error instanceof _pdfjs.RenderingCancelledException) { |
|
|
|
self.error = null; |
|
|
|
_this.error = null; |
|
|
|
return Promise.resolve(undefined); |
|
|
|
return Promise.resolve(undefined); |
|
|
|
} |
|
|
|
} |
|
|
|
self.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; |
|
|
|
_this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; |
|
|
|
if (self.loadingIconDiv) { |
|
|
|
if (_this.loadingIconDiv) { |
|
|
|
div.removeChild(self.loadingIconDiv); |
|
|
|
div.removeChild(_this.loadingIconDiv); |
|
|
|
delete self.loadingIconDiv; |
|
|
|
delete _this.loadingIconDiv; |
|
|
|
} |
|
|
|
} |
|
|
|
self._resetZoomLayer(true); |
|
|
|
_this._resetZoomLayer(true); |
|
|
|
self.error = error; |
|
|
|
_this.error = error; |
|
|
|
self.stats = pdfPage.stats; |
|
|
|
_this.stats = pdfPage.stats; |
|
|
|
if (self.onAfterDraw) { |
|
|
|
if (_this.onAfterDraw) { |
|
|
|
self.onAfterDraw(); |
|
|
|
_this.onAfterDraw(); |
|
|
|
} |
|
|
|
} |
|
|
|
self.eventBus.dispatch('pagerendered', { |
|
|
|
_this.eventBus.dispatch('pagerendered', { |
|
|
|
source: self, |
|
|
|
source: _this, |
|
|
|
pageNumber: self.id, |
|
|
|
pageNumber: _this.id, |
|
|
|
cssTransform: false |
|
|
|
cssTransform: false |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
@ -1534,28 +1534,28 @@ var PDFPageView = function PDFPageViewClosure() { |
|
|
|
cont(); |
|
|
|
cont(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
renderTask.promise.then(function pdfPageRenderCallback() { |
|
|
|
renderTask.promise.then(function () { |
|
|
|
showCanvas(); |
|
|
|
showCanvas(); |
|
|
|
renderCapability.resolve(undefined); |
|
|
|
renderCapability.resolve(undefined); |
|
|
|
}, function pdfPageRenderError(error) { |
|
|
|
}, function (error) { |
|
|
|
showCanvas(); |
|
|
|
showCanvas(); |
|
|
|
renderCapability.reject(error); |
|
|
|
renderCapability.reject(error); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
paintOnSvg: function paintOnSvg(wrapper) { |
|
|
|
|
|
|
|
var _this2 = this; |
|
|
|
|
|
|
|
|
|
|
|
paintOnSvg: function PDFPageView_paintOnSvg(wrapper) { |
|
|
|
|
|
|
|
var cancelled = false; |
|
|
|
var cancelled = false; |
|
|
|
var ensureNotCancelled = function ensureNotCancelled() { |
|
|
|
var ensureNotCancelled = function ensureNotCancelled() { |
|
|
|
if (cancelled) { |
|
|
|
if (cancelled) { |
|
|
|
if (_pdfjs.PDFJS.pdfjsNext) { |
|
|
|
if (_pdfjs.PDFJS.pdfjsNext) { |
|
|
|
throw new _pdfjs.RenderingCancelledException('Rendering cancelled, page ' + self.id, 'svg'); |
|
|
|
throw new _pdfjs.RenderingCancelledException('Rendering cancelled, page ' + _this2.id, 'svg'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw 'cancelled'; |
|
|
|
throw 'cancelled'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
var self = this; |
|
|
|
|
|
|
|
var pdfPage = this.pdfPage; |
|
|
|
var pdfPage = this.pdfPage; |
|
|
|
var actualSizeViewport = this.viewport.clone({ scale: _ui_utils.CSS_UNITS }); |
|
|
|
var actualSizeViewport = this.viewport.clone({ scale: _ui_utils.CSS_UNITS }); |
|
|
|
var promise = pdfPage.getOperatorList().then(function (opList) { |
|
|
|
var promise = pdfPage.getOperatorList().then(function (opList) { |
|
|
@ -1563,11 +1563,11 @@ var PDFPageView = function PDFPageViewClosure() { |
|
|
|
var svgGfx = new _pdfjs.SVGGraphics(pdfPage.commonObjs, pdfPage.objs); |
|
|
|
var svgGfx = new _pdfjs.SVGGraphics(pdfPage.commonObjs, pdfPage.objs); |
|
|
|
return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) { |
|
|
|
return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) { |
|
|
|
ensureNotCancelled(); |
|
|
|
ensureNotCancelled(); |
|
|
|
self.svg = svg; |
|
|
|
_this2.svg = svg; |
|
|
|
self.paintedViewportMap.set(svg, actualSizeViewport); |
|
|
|
_this2.paintedViewportMap.set(svg, actualSizeViewport); |
|
|
|
svg.style.width = wrapper.style.width; |
|
|
|
svg.style.width = wrapper.style.width; |
|
|
|
svg.style.height = wrapper.style.height; |
|
|
|
svg.style.height = wrapper.style.height; |
|
|
|
self.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; |
|
|
|
_this2.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; |
|
|
|
wrapper.appendChild(svg); |
|
|
|
wrapper.appendChild(svg); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -1581,6 +1581,7 @@ var PDFPageView = function PDFPageViewClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setPageLabel: function PDFView_setPageLabel(label) { |
|
|
|
setPageLabel: function PDFView_setPageLabel(label) { |
|
|
|
this.pageLabel = typeof label === 'string' ? label : null; |
|
|
|
this.pageLabel = typeof label === 'string' ? label : null; |
|
|
|
if (this.pageLabel !== null) { |
|
|
|
if (this.pageLabel !== null) { |
|
|
|