mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Simplify writeObject function
It'll avoid to have the duplication of the code to get the encrypt transform, and last but not least, it'll avoid to forget about encryption.
This commit is contained in:
parent
b903b3030a
commit
52cc1220e4
3 changed files with 24 additions and 98 deletions
|
@ -321,16 +321,7 @@ class Page {
|
|||
const savedDict = pageDict.get("Annots");
|
||||
pageDict.set("Annots", annotationsArray);
|
||||
const buffer = [];
|
||||
|
||||
let transform = null;
|
||||
if (this.xref.encrypt) {
|
||||
transform = this.xref.encrypt.createCipherTransform(
|
||||
this.ref.num,
|
||||
this.ref.gen
|
||||
);
|
||||
}
|
||||
|
||||
await writeObject(this.ref, pageDict, buffer, transform);
|
||||
await writeObject(this.ref, pageDict, buffer, this.xref);
|
||||
if (savedDict) {
|
||||
pageDict.set("Annots", savedDict);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue