PDF for UWP | ComponentOne
Using PDF for UWP / Applying Security and Permissions
In This Topic
    Applying Security and Permissions
    In This Topic
    The encryption scheme used by PDF for UWP is public and is not 100% secure. There are ways to crack encrypted PDF documents. The security provided is adequate to protect your documents from most casual attacks, but if your data is truly sensitive you should not rely on PDF encryption alone.

    By default, anyone can open, copy, print, and edit PDF files. If your PDF documents contain sensitive information, however, you can encrypt them so that only authorized users can access it.

    There is a separate password for the owner of the document and for all other users. The user's access can be selectively restricted to allow only certain operations, such as viewing, printing, or editing the document.

    PDF for UWP provides a C1PdfDocumentBase.Security property that returns a PdfSecurity object. This object has properties that allow you to specify the owner password (required to change passwords and permissions for the document) and the user password (required to open the document). Additionally, the PdfSecurity object allows you to specify what permissions a regular user should have. For example you may allow users to see the document but not to print or edit it.

    To use the PDF for UWP security features, simply set the passwords before you save the document. For example:

    Visual Basic
    Copy Code
    ' Create the document as usual.
    CreateDoc()
    
    ' Set passwords.
    _c1pdf.Security.OwnerPassword = "2mds%dffgd"
    _c1pdf.Security.UserPassword = "anyone"
    _c1pdf.Security.AllowEditAnnotations = False
    _c1pdf.Security.AllowEditContent = False
    _c1pdf.Security.AllowPrint = False
    

    C#
    Copy Code
    // Create the document as usual.
    CreateDoc();
    
    // Set passwords.
    _c1pdf.Security.OwnerPassword = "2mds%dffgd";
    _c1pdf.Security.UserPassword = "anyone";
    _c1pdf.Security.AllowEditAnnotations = false;
    _c1pdf.Security.AllowEditContent = false;
    _c1pdf.Security.AllowPrint = false;
    

    Save the document using the Save method as explained in the quick start topic, Step 3 of 4: Saving the document.

    You can specify permissions and set only the owner password, leaving the user password empty. In this case, anyone will be allowed to open the document, but only the owner will be allowed to change the permissions.