Dealing with Large Encrypted Files
PSPDFKit already implements the
AESCryptoDataProvider. It uses
DataProviding and provides all the delegates to dynamically decrypt just the required part of the PDF on the fly. All you need to do is provide the unencrypted file size and the callbacks for direct access.
The naive approach to this would be using
DataContainerProvider, but this is limited to the amount of available memory, and it’s generally not a good idea once your documents are above 20 MB.
❗Important: You should disable the disk cache by setting its
0. Otherwise, it’ll essentially invalidate the benefits of encrypting the PDF.