open
fun open(bytes: ByteArray, password: ByteArray = byteArrayOf(), allowInvalidPassword: Boolean = false): PdfDocument
open with a String password.
Encoding rule (follows MuPDF): the password is tried as raw UTF-8 bytes first. ISO 32000-2 nominally wants SASLprep for R6/V5, but every real implementation, MuPDF included, uses plain UTF-8. If UTF-8 fails to authenticate and the string contains non-ASCII characters, the same string is retried once encoded as Latin-1 (code points above U+00FF become '?'), which is the practical PDFDocEncoding rule legacy R<=4 files expect. The ByteArray overload remains the escape hatch for exotic encodings.