Module Pdfcrypt


module Pdfcrypt: sig .. end
40-bit, 128-bit and AES Decryption


Note that encryption depends on fixed object and generation numbers: don't change these (for example by calling Pdf.remove_unreferenced on the PDF) before writing.

Encryption support is part of the Pdfwrite module.

type permission =
| NoEdit
| NoPrint
| NoCopy
| NoAnnot
| NoForms
| NoExtract
| NoAssemble
| NoHqPrint

val decrypt_pdf : string -> Pdf.pdfdoc -> Pdf.pdfdoc option * permission list
Decrypt a PDF document, given the user password, returning the permissions under which the document was encrypted.
val decrypt_pdf_owner : string -> Pdf.pdfdoc -> Pdf.pdfdoc option
Decrypt a PDF document, given the owner password.
val recrypt_pdf : Pdf.pdfdoc -> Pdf.pdfdoc -> string -> Pdf.pdfdoc
recrypt_pdf original decrypted_and_modified re-encrypts a PDF document which was decrypted using the user password and owner password from the original encrypted file and the same permissions and encryption parameters.