Home Features Download License Tutorial Version History Source Code
This sample shows how to protect your PDF document with a password.
There are two passwords types: a “user” and an “owner” password:
C# :
using PDFMosaic; using System; namespace SetPassword { class SetPassword { static void Main() { PDFDocument document = new PDFDocument(); document.Pages.Add(new PDFPage(PDFPaperFormat.A4)); document.Security.EncryptionAlgorithm = PDFEncryptionAlgorithm.el40bitRC4; document.Security.UserPassword = "test"; document.Save("SetPassword.pdf", true); } } }
Visial Basic.NET :
Imports PDFMosaic Imports System Module SetPassword Sub Main() Dim document As New PDFDocument() document.Pages.Add(New PDFPage(PDFPaperFormat.A4)) document.Security.EncryptionAlgorithm = PDFEncryptionAlgorithm.el40bitRC4 document.Security.UserPassword = "test" document.Save("SetPassword.pdf", True) End Sub End Module
Home Features Download License Tutorial Version History Source Code