How to set PDF security

About PDF security

A PDF file may be encrypted for security, or digitally signed for authentication.

The standard security provided by Acrobat PDF consists of two different methods and two different passwords, "user password" and "owner password".

A PDF document may be protected by password to open ('user' password) and the document may also specify operations that should be restricted even when the document is decrypted: printing, copying text and graphics out of the document, modifying the document, or adding or modifying text notes and AcroForm fields (using 'owner' password).

PDF document security should not be used as primary way of securing sensitive data, all operations (except the document open password protection, if applicable) which are restricted by "owner" or "user" passwords can be easily cracked by third party applications.

Even without removing the password, most freeware or open source PDF readers will ignore the digital rights management "protections" and will allow the user to print or make copy of excerpts of the text as if the document were not limited by password protection.

Swing PDF Converter provides basic PDF document security, this includes:

  • User password

  • Master password

  • No printing

  • No changing the document

  • No content copying or extraction, disable accessibility

  • No adding or changing comments and form fields

User password

Authenticated user rights:

  • Decrypt PDF document

  • Read PDF document

  • Other rights are defined by master user.

Master password

Master user rights:

  • Change user rights

  • Decrypt PDF document

  • Read PDF document

  • Print PDF document

  • Modify PDF document

  • Extract data from PDF document

Setting PDF Security from Lotus Notes

PDF Security can be set from "PDF Settings" view in the PDF Converter database.

Setting PDF Security from LotusScript API

The following article article explains how to set Swing PDF Converter API in custom application:

LotusScript sample code

    Use "SwPDFMain"
    Sub Click(Source As Button)
    Dim w As New NotesUIWorkspace, doc As NotesDocument
    Dim swPDF As New SwPDFCreator, swPDFDoc As SwPDFDocument, pdfErr As SwPDFError
    Dim DestFilePath As Variant

    On Error Goto Ooops

    If w.CurrentDocument.IsNewDoc Then
        Msgbox "Document must be saved first in order to convert it to a PDF.", 0+48, "WARNING"
    Else
        ' Get destination file path
        DestFilePath = w.SaveFileDialog(False, "Save document", "PDF Files (*.pdf)|*.pdf", "", "test.pdf")
        If Not Isempty(DestFilePath)Then
            If Dir$(DestFilePath(0)) <> "" Then
                dialogRes = Messagebox(DestFilePath(0) & " already exists." & Chr$(13) & Chr$(10) & "Do you want to replace it?", 4, "Save document")
                If dialogRes = 7 Then
                    Exit Sub
                Else
                    Kill DestFilePath(0)
                End If
            End If

        ' Procceed with PDF conversion
        ' Get currently opened Notes document
        Set doc = w.CurrentDocument.Document

        ' Initialize PDF creation process; license key is required
        If swPDF.Init("<YOUR LICENSE KEY GOES HERE>") Then
            ' enable font embedding for non ascii characters
            swPDF.PDFSettings.EnableFontEmbedding = True

            ' Set PDF document security
            swPDF.PDFSettings.UserPassword = "User"
            swPDF.PDFSettings.MasterPassword = "Master"
            swPDF.PDFSettings.Enable128bitEncryption = False
            swPDF.PDFSettings.EnablePrinting = False
            swPDF.PDFSettings.EnableChanging = False
            swPDF.PDFSettings.EnableCopying = False
            swPDF.PDFSettings.EnableComments = False
            swPDF.PDFSettings.EnableFormFields = False

            ' Convert doc to PDF
            Set swPDFDoc = swPDF.ProcessDocument(doc)

            If Not swPDFDoc Is Nothing Then
                ' Finally, save generated PDF to a file on disk
                Call swPDFDoc.SaveToFile(DestFilePath(0))
                Msgbox "PDF successfully created in " & DestFilePath(0)
            Else
                ' There was an error in PDF conversion
                Set pdfErr = swPDF.GetError()
                Msgbox pdfErr.Message, 0+16, "ERROR"
            End If
        Else
            ' There was an error in PDF initialization
            Set pdfErr = swPDF.GetError()
            Msgbox pdfErr.Message, 0+16, "ERROR"
        End If
      End If
    End If
    Exit Sub
    Ooops:
        Msgbox "Error: " + Error + " On line: " + Erl
        Exit Sub
    End Sub

Last updated