mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
XFA - Move the fake HTML representation of XFA from the worker to the main thread
- the only goal of this patch is to be able to get synchronously the fake html when printing from firefox: - in order to print we need to inject some html in beforeprint callback but we cannot block in waiting for all the pages. - from a memory point of view: it doesn't change anything since the fake HTML is deleted in the worker; - this way we don't break any assumptions.
This commit is contained in:
parent
9478d2f064
commit
45c3f00a27
5 changed files with 50 additions and 32 deletions
|
@ -187,13 +187,13 @@ class WorkerMessageHandler {
|
|||
await pdfManager.ensureDoc("checkFirstPage");
|
||||
}
|
||||
|
||||
const [numPages, fingerprint, isPureXfa] = await Promise.all([
|
||||
const [numPages, fingerprint, htmlForXfa] = await Promise.all([
|
||||
pdfManager.ensureDoc("numPages"),
|
||||
pdfManager.ensureDoc("fingerprint"),
|
||||
pdfManager.ensureDoc("isPureXfa"),
|
||||
pdfManager.ensureDoc("htmlForXfa"),
|
||||
]);
|
||||
|
||||
if (isPureXfa) {
|
||||
if (htmlForXfa) {
|
||||
const task = new WorkerTask("loadXfaFonts");
|
||||
startWorkerTask(task);
|
||||
await pdfManager
|
||||
|
@ -203,7 +203,7 @@ class WorkerMessageHandler {
|
|||
})
|
||||
.then(() => finishWorkerTask(task));
|
||||
}
|
||||
return { numPages, fingerprint, isPureXfa };
|
||||
return { numPages, fingerprint, htmlForXfa };
|
||||
}
|
||||
|
||||
function getPdfManager(data, evaluatorOptions, enableXfa) {
|
||||
|
@ -501,12 +501,6 @@ class WorkerMessageHandler {
|
|||
});
|
||||
});
|
||||
|
||||
handler.on("GetPageXfa", function wphSetupGetXfa({ pageIndex }) {
|
||||
return pdfManager.getPage(pageIndex).then(function (page) {
|
||||
return pdfManager.ensure(page, "xfaData");
|
||||
});
|
||||
});
|
||||
|
||||
handler.on("GetOutline", function wphSetupGetOutline(data) {
|
||||
return pdfManager.ensureCatalog("documentOutline");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue