Reputation: 3117
I have created a pdf using itextsharp
. The requirement is that while sending the PDF as attachment in an email and it should be password protected.
I know that we can make a pdf password protected while creating it using itextsharp
.
Is there any way to make an existing pdf password protected?
Upvotes: 1
Views: 1176
Reputation: 77528
Use PdfReader
in combination with PdfStamper
and the setEncryption()
method.
In Java, see encryptPdf()
in this example: http://itextpdf.com/examples/iia.php?id=219
In C#, see EncryptPdf()
in this example: http://kuujinbo.info/iTextInAction2Ed/index.aspx?ch=Chapter12&ex=EncryptionPdf
Upvotes: 1