Add a |textlayerrendered| event

This commit is contained in:
Jonas Jenwald 2014-12-31 13:10:59 +01:00
parent 34203e5367
commit 3f061cef86
2 changed files with 30 additions and 14 deletions

View file

@ -1741,18 +1741,6 @@ document.addEventListener('pagerendered', function (e) {
Stats.add(pageNumber, pageView.stats);
}
//#if (FIREFOX || MOZCENTRAL)
//if (pageView.textLayer && pageView.textLayer.textDivs &&
// pageView.textLayer.textDivs.length > 0 &&
// !PDFViewerApplication.supportsDocumentColors) {
// console.error(mozL10n.get('document_colors_disabled', null,
// 'PDF documents are not allowed to use their own colors: ' +
// '\'Allow pages to choose their own colors\' ' +
// 'is deactivated in the browser.'));
// PDFViewerApplication.fallback();
//}
//#endif
if (pageView.error) {
PDFViewerApplication.error(mozL10n.get('rendering_error', null,
'An error occurred while rendering the page.'), pageView.error);
@ -1779,6 +1767,23 @@ document.addEventListener('pagerendered', function (e) {
}
}, true);
document.addEventListener('textlayerrendered', function (e) {
var pageIndex = e.detail.pageNumber - 1;
var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
//#if (FIREFOX || MOZCENTRAL)
//if (pageView.textLayer && pageView.textLayer.textDivs &&
// pageView.textLayer.textDivs.length > 0 &&
// !PDFViewerApplication.supportsDocumentColors) {
// console.error(mozL10n.get('document_colors_disabled', null,
// 'PDF documents are not allowed to use their own colors: ' +
// '\'Allow pages to choose their own colors\' ' +
// 'is deactivated in the browser.'));
// PDFViewerApplication.fallback();
//}
//#endif
}, true);
window.addEventListener('presentationmodechanged', function (e) {
var active = e.detail.active;
var switchInProgress = e.detail.switchInProgress;