1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

[Annotation] Avoid to encrypt the appearance stream two times (bug 1815476)

This commit is contained in:
Calixte Denizet 2023-02-07 19:26:46 +01:00
parent c971f4a0a9
commit ea7b4b4d6c
6 changed files with 34 additions and 19 deletions

View file

@ -1894,13 +1894,11 @@ class WidgetAnnotation extends Annotation {
let newTransform = null;
if (encrypt) {
newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
appearance = newTransform.encryptString(appearance);
}
const resources = this._getSaveFieldResources(xref);
const appearanceStream = new StringStream(appearance);
const appearanceDict = (appearanceStream.dict = new Dict(xref));
appearanceDict.set("Length", appearance.length);
appearanceDict.set("Subtype", Name.get("Form"));
appearanceDict.set("Resources", resources);
appearanceDict.set("BBox", [
@ -3669,7 +3667,6 @@ class FreeTextAnnotation extends MarkupAnnotation {
appearanceStreamDict.set("Subtype", Name.get("Form"));
appearanceStreamDict.set("Type", Name.get("XObject"));
appearanceStreamDict.set("BBox", [0, 0, w, h]);
appearanceStreamDict.set("Length", appearance.length);
appearanceStreamDict.set("Resources", resources);
if (rotation) {