diff --git a/cpdf.ml b/cpdf.ml index 223bd7a..a8572d6 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -1285,7 +1285,7 @@ let get_metadata pdf = | Some root -> match Pdf.lookup_direct pdf "/Metadata" root with | Some ((Pdf.Stream _) as s) -> - Pdf.getstream s; + Pdfcodec.decode_pdfstream pdf s; begin match s with | Pdf.Stream {contents = (_, Pdf.Got data)} -> Some data | _ -> assert false diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 57e351b..8a1fcc7 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -545,11 +545,13 @@ let rec decrypt_if_necessary (_, _, _, user_pw, owner_pw) op pdf = end; if not (Pdfcrypt.is_encrypted pdf) then pdf else match Pdfcrypt.decrypt_pdf_owner owner_pw pdf with - | Some pdf -> pdf + | Some pdf -> + Printf.printf "Managed to decrypt with owner password"; pdf | _ -> Printf.printf "Couldn't decrypt with owner password %s\n" owner_pw; match Pdfcrypt.decrypt_pdf user_pw pdf with | Some pdf, permissions -> + Printf.printf "Managed to decrypt with user password\n"; if operation_allowed permissions op then pdf else soft_error "User password cannot give permission for this operation"