PDF encryption with selected components to encrypt

Hi,

We are encrypting PDF documents using the below method:

document.encrypt("user", "owner", documentPrivilege, CryptoAlgorithm.AESx128, false);

This approach encrypts all document content including metadata. Is there a way to encrypt content except metadata so that the search engines can still access document’s metadata?

An approach that mimics the following option in Acrobat Pro
image.png (3.8 KB)

Thanks

@pawangandhi

Can you please share the sample PDF document for our reference as well along with the screenshot of how you are checking the encryption of the metadata? We will further proceed to assist you accordingly.