Merge pull request #16588 from calixteman/editor_stamp_2

[Editor] Add support for printing/saving newly added Stamp annotations
This commit is contained in:
calixteman 2023-06-28 22:42:54 +02:00 committed by GitHub
commit 88c7c8b5bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 519 additions and 19 deletions

View file

@ -1819,6 +1819,15 @@ class PDFPageProxy {
);
}
const transfers = [];
if (annotationStorageMap) {
for (const annotation of annotationStorageMap.values()) {
if (annotation.bitmap) {
transfers.push(annotation.bitmap);
}
}
}
const readableStream = this._transport.messageHandler.sendWithStream(
"GetOperatorList",
{
@ -1826,7 +1835,8 @@ class PDFPageProxy {
intent: renderingIntent,
cacheKey,
annotationStorage: annotationStorageMap,
}
},
transfers
);
const reader = readableStream.getReader();
@ -2905,13 +2915,26 @@ class WorkerTransport {
"please use the getData-method instead."
);
}
const annotationStorage = this.annotationStorage.serializable;
const transfers = [];
if (annotationStorage) {
for (const annotation of annotationStorage.values()) {
if (annotation.bitmap) {
transfers.push(annotation.bitmap);
}
}
}
return this.messageHandler
.sendWithPromise("SaveDocument", {
isPureXfa: !!this._htmlForXfa,
numPages: this._numPages,
annotationStorage: this.annotationStorage.serializable,
filename: this._fullReader?.filename ?? null,
})
.sendWithPromise(
"SaveDocument",
{
isPureXfa: !!this._htmlForXfa,
numPages: this._numPages,
annotationStorage,
filename: this._fullReader?.filename ?? null,
},
transfers
)
.finally(() => {
this.annotationStorage.resetModified();
});