Backup work before redoing the textContent format

This commit is contained in:
Julian Viereck 2012-09-11 16:05:43 -07:00
parent a38c4bc729
commit eced7fbb57

View File

@ -1231,6 +1231,8 @@ var PageView = function pageView(container, pdfPage, id, scale,
this.renderingState = RenderingStates.INITIAL;
this.resume = null;
this.textContent = null;
var anchor = document.createElement('a');
anchor.name = '' + this.id;
@ -1485,6 +1487,22 @@ var PageView = function pageView(container, pdfPage, id, scale,
var self = this;
function pageViewDrawCallback(error) {
var visiblePages = PDFView.getVisiblePages();
var pageView = PDFView.getHighestPriority(visiblePages, PDFView.pages,
PDFView.pageViewScroll.down);
if (pageView === self) {
if (!self.textContent) {
self.textContent = {};
self.pdfPage.getTextContent().then(
function textContentResolved(textContent) {
self.textContent = textContent;
textLayer.setTextContent(textContent);
}
);
}
}
self.renderingState = RenderingStates.FINISHED;
if (self.loadingIconDiv) {
@ -1890,10 +1908,16 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
textDiv.style.fontFamily = fontName;
textDiv.style.left = text.geom.x + 'px';
textDiv.style.top = (text.geom.y - fontHeight) + 'px';
textDiv.textContent = PDFJS.bidi(text, -1);
textDiv.dir = text.direction;
// The `text.direction` is added inside the PDFJS.bidi function.
// textDiv.textContent = PDFJS.bidi(text, -1);
// textDiv.dir = text.direction;
this.textDivs.push(textDiv);
};
this.setTextContent = function textLayerBuilderSetTextContent(textContent) {
// When calling this function, we assume rendering the textDivs has finished
};
};
document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {