Merge permissions now fixed

This commit is contained in:
John Whitington 2014-11-05 14:05:20 +00:00
parent 60c055141f
commit 5467114631
1 changed files with 21 additions and 9 deletions

View File

@ -2898,15 +2898,27 @@ let go () =
write_pdf false pdf write_pdf false pdf
| _ -> | _ ->
(* We check permissions. A merge is allowed if each file (* We check permissions. A merge is allowed if each file
included was (a) not encrypted, or (b) decrypted using included was (a) not encrypted (detected by the absence of
the owner password *) saved encryption information in the PDF, or (b) decrypted using
(* If args.keep_this_id is set, change the ID to the one from the kept one *) the owner password (stored in the input) *)
let rangenums = map2 parse_pagespec pdfs ranges in if
let outpdf = not
Pdfmerge.merge_pdfs ~rotations args.retain_numbering args.remove_duplicate_fonts (fold_left ( && ) true
(map string_of_input_kind names) pdfs rangenums (map2
in (fun (_, _, _, _, _, was_dec_with_owner) pdf ->
write_pdf false outpdf !was_dec_with_owner || pdf.Pdf.saved_encryption = None)
inputs
pdfs))
then
soft_error "Merge requires the owner password for all encrypted files."
else
(* If args.keep_this_id is set, change the ID to the one from the kept one *)
let rangenums = map2 parse_pagespec pdfs ranges in
let outpdf =
Pdfmerge.merge_pdfs ~rotations args.retain_numbering args.remove_duplicate_fonts
(map string_of_input_kind names) pdfs rangenums
in
write_pdf false outpdf
end end
| _ -> | _ ->
match args.op with match args.op with