open

fun open(bytes: ByteArray, password: String = "", epubSettings: EpubSettings = EpubSettings()): KiteDocument

Reads bytes as whichever format they are.

Parameters

password

for an encrypted PDF; ignored for every other format.

epubSettings

page size, font size and margins for an EPUB; ignored for every other format. Re-flow later with EpubDocument.withSettings instead of re-opening.

Throws

when the bytes are no known format, or are a known format but unreadable. Unrecognised bytes get one last try as a damaged PDF first, because the PDF reader can rebuild a file whose header was lost.

when a PDF is encrypted and password does not authenticate.