How to Make Password protected PDf

Hi All,
I am using vb.net coding for aspose pdf.Right now I saved pdf file to file system as well.

I want to make that pdf file to be password protected one.So can you please give the code for making the pdf file password protection.

Hope you all understand my requirements.
thanks in advance

Hi there,


Thanks for your inquiry. Please check following VB code snippet and documentation link for encrypting PDF file. Hopefully it will help you to accomplish the task.


'open document<o:p></o:p>

Dim document As New Document("input.pdf")

'encrypt PDF

document.Encrypt("user", "owner", 0, CryptoAlgorithm.RC4x128)

'save updated PDF

document.Save("output.pdf")

Please feel free to contact us for any further assistance.


Best Regards,