mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Add a |textlayerrendered| event
This commit is contained in:
parent
34203e5367
commit
3f061cef86
2 changed files with 30 additions and 14 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue