VintaSoft PDF .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft PDF .NET Plug-in Discussions
EncryptionSystem encSystem = new EncryptionSystem(
EncryptionAlgorithm.RC4, 40, "userpwd", "ownerpwd", UserAccessPermissions.ExtractTextAndGraphics);
using (PdfDocument document = new PdfDocument(PdfFormat.Pdf_16, encSystem))
{
document.Pages.Add(PaperSizeKind.A4);
document.Save(filename);
}
encSystem.Dispose();
If you want to change security properties of an existing PDF document, do it in the same way. The following code should work:
EncryptionSystem encSystem = new EncryptionSystem(
EncryptionAlgorithm.RC4, 40, "userpwd", "ownerpwd", UserAccessPermissions.ExtractTextAndGraphics);
using (PdfDocument documentOriginal = new PdfDocument(inFilename))
using (PdfDocument documentChanged = new PdfDocument(PdfFormat.Pdf_16, encSystem))
{
documentChanged.Pages.AddRange(documentOriginal.Pages.ToArray());
documentChanged.Save(outFilename);
}
encSystem.Dispose();