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

[Editor] Don't forget to encrypt image streams (see issue #16821)

and encrypt a compressed stream after having been compressed.
This commit is contained in:
Calixte Denizet 2023-08-10 15:19:41 +02:00
parent d4ba312f00
commit 7a5b3423d6
5 changed files with 51 additions and 6 deletions

View file

@ -46,9 +46,6 @@ async function writeDict(dict, buffer, transform) {
async function writeStream(stream, buffer, transform) {
let string = stream.getString();
if (transform !== null) {
string = transform.encryptString(string);
}
const { dict } = stream;
const [filter, params] = await Promise.all([
@ -106,6 +103,10 @@ async function writeStream(stream, buffer, transform) {
}
}
if (transform !== null) {
string = transform.encryptString(string);
}
dict.set("Length", string.length);
await writeDict(dict, buffer, transform);
buffer.push(" stream\n", string, "\nendstream");