Skip to content

Commit b531720

Browse files
committed
Simplify the serializeXfaData method and related code
Rather than having a dedicated `BasePdfManager`-method for this one call-site we can instead change `PDFDocument.prototype.serializeXfaData` to a non-async method, that we invoke via `BasePdfManager.prototype.ensureDoc`.
1 parent 91bfe12 commit b531720

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/core/document.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ class PDFDocument {
14081408
this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
14091409
}
14101410

1411-
async serializeXfaData(annotationStorage) {
1411+
serializeXfaData(annotationStorage) {
14121412
return this.xfaFactory
14131413
? this.xfaFactory.serializeData(annotationStorage)
14141414
: null;

src/core/pdf_manager.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ class BasePdfManager {
127127
return this.pdfDocument.loadXfaImages();
128128
}
129129

130-
serializeXfaData(annotationStorage) {
131-
return this.pdfDocument.serializeXfaData(annotationStorage);
132-
}
133-
134130
cleanup(manuallyTriggered = false) {
135131
return this.pdfDocument.cleanup(manuallyTriggered);
136132
}

src/core/worker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,9 @@ class WorkerMessageHandler {
617617
}
618618

619619
if (isPureXfa) {
620-
promises.push(pdfManager.serializeXfaData(annotationStorage));
620+
promises.push(
621+
pdfManager.ensureDoc("serializeXfaData", [annotationStorage])
622+
);
621623
} else {
622624
for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
623625
promises.push(

0 commit comments

Comments
 (0)