mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge upstream and change to error parameter for callback.
This commit is contained in:
commit
e0c231eec7
16 changed files with 500 additions and 182 deletions
|
@ -232,6 +232,27 @@ canvas {
|
|||
-webkit-box-shadow: 0px 2px 10px #ff0;
|
||||
}
|
||||
|
||||
.textLayer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.textLayer > div {
|
||||
color: transparent;
|
||||
position: absolute;
|
||||
line-height:1.3;
|
||||
}
|
||||
|
||||
/* TODO: file FF bug to support ::-moz-selection:window-inactive
|
||||
so we can override the opaque grey background when the window is inactive;
|
||||
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
|
||||
::selection { background:rgba(0,0,255,0.3); }
|
||||
::-moz-selection { background:rgba(0,0,255,0.3); }
|
||||
|
||||
#viewer {
|
||||
margin: 44px 0px 0px;
|
||||
padding: 8px 0px;
|
||||
|
|
|
@ -263,7 +263,7 @@ var PDFView = {
|
|||
var container = document.getElementById('viewer');
|
||||
while (container.hasChildNodes())
|
||||
container.removeChild(container.lastChild);
|
||||
|
||||
|
||||
var pdf;
|
||||
try {
|
||||
pdf = new PDFJS.PDFDoc(data);
|
||||
|
@ -291,10 +291,10 @@ var PDFView = {
|
|||
pagesRefMap[pageRef.num + ' ' + pageRef.gen + ' R'] = i;
|
||||
}
|
||||
|
||||
this.setScale(scale || kDefaultScale, true);
|
||||
|
||||
this.pagesRefMap = pagesRefMap;
|
||||
this.destinations = pdf.catalog.destinations;
|
||||
this.setScale(scale || kDefaultScale, true);
|
||||
|
||||
if (pdf.catalog.documentOutline) {
|
||||
this.outline = new DocumentOutlineView(pdf.catalog.documentOutline);
|
||||
var outlineSwitchButton = document.getElementById('outlineSwitch');
|
||||
|
@ -542,6 +542,10 @@ var PageView = function pageView(container, content, id, pageWidth, pageHeight,
|
|||
div.appendChild(canvas);
|
||||
this.canvas = canvas;
|
||||
|
||||
var textLayer = document.createElement('div');
|
||||
textLayer.className = 'textLayer';
|
||||
div.appendChild(textLayer);
|
||||
|
||||
var scale = this.scale;
|
||||
canvas.width = pageWidth * scale;
|
||||
canvas.height = pageHeight * scale;
|
||||
|
@ -555,14 +559,13 @@ var PageView = function pageView(container, content, id, pageWidth, pageHeight,
|
|||
|
||||
stats.begin = Date.now();
|
||||
this.content.startRendering(ctx,
|
||||
(function pageViewDrawCallback() {
|
||||
(function pageViewDrawCallback(error) {
|
||||
if (error)
|
||||
PDFView.error('An error occurred while rendering the page.', error);
|
||||
this.updateStats();
|
||||
if (this.onAfterDraw)
|
||||
this.onAfterDraw();
|
||||
}).bind(this),
|
||||
function pageViewErrorback(e) {
|
||||
PDFView.error('An error occurred while rendering the page.', e);
|
||||
}
|
||||
}).bind(this), textLayer
|
||||
);
|
||||
|
||||
setupLinks(this.content, this.scale);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue