1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Add the number of textDivs to the textlayerrendered event, to avoid having to manually get that information in the event handler

This commit is contained in:
Jonas Jenwald 2016-08-01 12:06:12 +02:00
parent 3904be8889
commit 885ba83624
2 changed files with 6 additions and 7 deletions

View file

@ -1632,18 +1632,13 @@ function webViewerPageRendered(e) {
}
function webViewerTextLayerRendered(e) {
var pageIndex = e.pageNumber - 1;
var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
//#if !PRODUCTION
if (true) {
return;
}
//#endif
//#if (FIREFOX || MOZCENTRAL)
if (pageView && pageView.textLayer && pageView.textLayer.textDivs &&
pageView.textLayer.textDivs.length > 0 &&
!PDFViewerApplication.supportsDocumentColors) {
if (e.numTextDivs > 0 && !PDFViewerApplication.supportsDocumentColors) {
console.error(mozL10n.get('document_colors_not_allowed', null,
'PDF documents are not allowed to use their own colors: ' +
'\'Allow pages to choose their own colors\' ' +

View file

@ -65,6 +65,9 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
}
TextLayerBuilder.prototype = {
/**
* @private
*/
_finishRendering: function TextLayerBuilder_finishRendering() {
this.renderingDone = true;
@ -76,7 +79,8 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
this.eventBus.dispatch('textlayerrendered', {
source: this,
pageNumber: this.pageNumber
pageNumber: this.pageNumber,
numTextDivs: this.textDivs.length,
});
},