diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-10-12 10:02:54 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-10-12 10:02:54 +0200 |
commit | 990c5d830eeb4ee2677eecf30fdd6f623bb37c61 (patch) | |
tree | be14d037487883f921d04dab47bb78e5e32c1b95 | |
parent | 0b39070666578a472b55a5b42fb85f2c6ddac1e9 (diff) | |
download | mupdf-990c5d830eeb4ee2677eecf30fdd6f623bb37c61.tar.xz |
write encryption dictionary as a separate object
-rw-r--r-- | mupdf/save.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mupdf/save.c b/mupdf/save.c index 02401cf3..b6cb7a92 100644 --- a/mupdf/save.c +++ b/mupdf/save.c @@ -216,6 +216,21 @@ pdf_savepdf(pdf_xref *xref, char *path, pdf_crypt *encrypt) int startxref; int *ofsbuf; fz_obj *obj; + int eoid, egen; + + /* need to add encryption object for acrobat < 6 */ + if (encrypt) + { + error = pdf_allocobject(xref, &eoid, &egen); + if (error) + return error; + + pdf_cryptobj(encrypt, encrypt->encrypt, eoid, egen); + + error = pdf_updateobject(xref, eoid, egen, encrypt->encrypt); + if (error) + return error; + } ofsbuf = fz_malloc(sizeof(int) * xref->len); if (!ofsbuf) @@ -274,12 +289,13 @@ pdf_savepdf(pdf_xref *xref, char *path, pdf_crypt *encrypt) fz_print(out, "\n /Info %d %d R", fz_tonum(obj), fz_togen(obj)); if (encrypt) { - fz_print(out, "\n /Encrypt "); - fz_printobj(out, encrypt->encrypt, 1); + fz_print(out, "\n /Encrypt %d %d R", eoid, egen); fz_print(out, "\n /ID ["); fz_printobj(out, encrypt->id, 1); fz_printobj(out, encrypt->id, 1); fz_print(out, "]"); + + pdf_cryptobj(encrypt, encrypt->encrypt, eoid, egen); } fz_print(out, "\n>>\n\n"); |