Backup work before redoing the textContent format
This commit is contained in:
parent
a38c4bc729
commit
eced7fbb57
@ -1231,6 +1231,8 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||||||
this.renderingState = RenderingStates.INITIAL;
|
this.renderingState = RenderingStates.INITIAL;
|
||||||
this.resume = null;
|
this.resume = null;
|
||||||
|
|
||||||
|
this.textContent = null;
|
||||||
|
|
||||||
var anchor = document.createElement('a');
|
var anchor = document.createElement('a');
|
||||||
anchor.name = '' + this.id;
|
anchor.name = '' + this.id;
|
||||||
|
|
||||||
@ -1485,6 +1487,22 @@ var PageView = function pageView(container, pdfPage, id, scale,
|
|||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
function pageViewDrawCallback(error) {
|
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;
|
self.renderingState = RenderingStates.FINISHED;
|
||||||
|
|
||||||
if (self.loadingIconDiv) {
|
if (self.loadingIconDiv) {
|
||||||
@ -1890,10 +1908,16 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
|
|||||||
textDiv.style.fontFamily = fontName;
|
textDiv.style.fontFamily = fontName;
|
||||||
textDiv.style.left = text.geom.x + 'px';
|
textDiv.style.left = text.geom.x + 'px';
|
||||||
textDiv.style.top = (text.geom.y - fontHeight) + '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.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) {
|
document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
||||||
|
Loading…
Reference in New Issue
Block a user