mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Use a proper MessageHandler
for PartialEvaluator.getTextContent
to avoid errors for fonts relying on built-in CMap files (PR 8064 follow-up)
*My apologies for inadvertently breaking this in PR 8064; apparently we don't have any tests that cover this use-case :(* Without this patch `getTextContent` will fail if called before `getOperatorList`, since loading of fonts during text-extraction may require fetching of built-in CMap files. *Please note:* The `text` test added here, which uses an already existing PDF file, fails without this patch.
This commit is contained in:
parent
68f2bf3bec
commit
3705e5e459
3 changed files with 10 additions and 8 deletions
|
@ -310,14 +310,9 @@ var Page = (function PageClosure() {
|
|||
});
|
||||
},
|
||||
|
||||
extractTextContent: function Page_extractTextContent(task,
|
||||
extractTextContent: function Page_extractTextContent(handler, task,
|
||||
normalizeWhitespace,
|
||||
combineTextItems) {
|
||||
var handler = {
|
||||
on: function nullHandlerOn() {},
|
||||
send: function nullHandlerSend() {}
|
||||
};
|
||||
|
||||
var self = this;
|
||||
|
||||
var pdfManager = this.pdfManager;
|
||||
|
|
|
@ -906,7 +906,7 @@ var WorkerMessageHandler = {
|
|||
startWorkerTask(task);
|
||||
var pageNum = pageIndex + 1;
|
||||
var start = Date.now();
|
||||
return page.extractTextContent(task, normalizeWhitespace,
|
||||
return page.extractTextContent(handler, task, normalizeWhitespace,
|
||||
combineTextItems).then(
|
||||
function(textContent) {
|
||||
finishWorkerTask(task);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue