Class SecurityOptions
- java.lang.Object
-
- com.ironsoftware.ironpdf.security.SecurityOptions
-
public class SecurityOptions extends Object
A class defining user security settings for a PDF document.Allows the developer to control user access passwords, encryption, and also who may edit, print and copy content from the PDF document
-
-
Constructor Summary
Constructors Constructor Description SecurityOptions()Instantiates a new Security options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfEditSecuritygetAllowUserEdits()Gets allow user edits.PdfPrintSecuritygetAllowUserPrinting()Gets allow user printing.PdfEncryptionTypegetEncryptionType()Gets the encryption algorithm used when the document is secured with a password.StringgetOwnerPassword()Gets owner password.StringgetUserPassword()Gets user password.BooleanisAllowUserAnnotations()Is allow user annotations boolean.BooleanisAllowUserCopyPasteContent()Is allow user copy and paste content boolean.BooleanisAllowUserCopyPasteContentForAccessibility()Is allow user copy and paste content for accessibility boolean.BooleanisAllowUserFormData()Is allow user form data boolean.BooleanisEncryptMetadata()Gets whether the document's metadata is encrypted along with its content.voidsetAllowUserAnnotations(Boolean value)Sets allow user annotations.voidsetAllowUserCopyPasteContent(Boolean value)Sets allow user copy and paste content.voidsetAllowUserCopyPasteContentForAccessibility(Boolean value)Sets allow user copy and paste content for accessibility.voidsetAllowUserEdits(PdfEditSecurity value)Sets allow user edits.voidsetAllowUserFormData(Boolean value)Sets allow user form data.voidsetAllowUserPrinting(PdfPrintSecurity value)Sets allow user printing.voidsetEncryptionType(PdfEncryptionType value)Sets the encryption algorithm used when the document is secured with a password.voidsetEncryptMetadata(Boolean value)Sets whether the document's metadata is encrypted along with its content.voidsetOwnerPassword(String value)Sets owner password.voidsetUserPassword(String value)Sets user password.
-
-
-
Method Detail
-
isAllowUserAnnotations
public final Boolean isAllowUserAnnotations()
Is allow user annotations boolean. The permissions for users to annotate the PDF document with comments.If AllowUserAnnotations is set false, the
setOwnerPassword(String)must be set for the security measure to take effect.- Returns:
- the boolean
-
setAllowUserAnnotations
public final void setAllowUserAnnotations(Boolean value)
Sets allow user annotations. The permissions for users to annotate the PDF document with comments.If AllowUserAnnotations is set false, the
setOwnerPassword(String)must be set for the security measure to take effect.- Parameters:
value- the value
-
isAllowUserCopyPasteContent
public final Boolean isAllowUserCopyPasteContent()
Is allow user copy and paste content boolean. The permissions for users to extract or 'copy & paste' content (text and images) from the PDF document.If AllowUserCopyPasteContent is set false, the
setOwnerPassword(String)must also be set for the security measure to take effect.- Returns:
- the boolean
-
setAllowUserCopyPasteContent
public final void setAllowUserCopyPasteContent(Boolean value)
Sets allow user copy and paste content. The permissions for users to extract or 'copy & paste' content (text and images) from the PDF document.If AllowUserCopyPasteContent is set false, the
setOwnerPassword(String)must also be set for the security measure to take effect.- Parameters:
value- the value
-
isAllowUserCopyPasteContentForAccessibility
public final Boolean isAllowUserCopyPasteContentForAccessibility()
Is allow user copy and paste content for accessibility boolean. The permissions for users to extract or 'copy & paste' content (text and images) from the PDF document for accessibility.- Returns:
- the boolean
-
setAllowUserCopyPasteContentForAccessibility
public final void setAllowUserCopyPasteContentForAccessibility(Boolean value)
Sets allow user copy and paste content for accessibility. The permissions for users to extract or 'copy & paste' content (text and images) from the PDF document for accessibility.- Parameters:
value- the value
-
getAllowUserEdits
public final PdfEditSecurity getAllowUserEdits()
Gets allow user edits. The permissions for users edit the PDF document. The features to edit the document depends entirely on the PDF client software used by the end user.If editing rights are restricted, then the
setOwnerPassword(String)must be set for the security measure to take effect.- Returns:
- allow user edits value
-
setAllowUserEdits
public final void setAllowUserEdits(PdfEditSecurity value)
Sets allow user edits. The permissions for users edit the PDF document. The features to edit the document depends entirely on the PDF client software used by the end user.If editing rights are restricted, then the
setOwnerPassword(String)must be set for the security measure to take effect.- Parameters:
value- the value
-
isAllowUserFormData
public final Boolean isAllowUserFormData()
Is allow user form data boolean. The permissions for users to fill-in (enter data into) forms in the PDF document.If AllowUserFormData is set false, the
setOwnerPassword(String)must be set for the security measure to take effect.Note. If you want to make the form readonly in Adobe Acrobat Reader please call
Security_Api.makePdfDocumentReadOnly(InternalPdfDocument, String)method or setsetAllowUserEdits(PdfEditSecurity)toPdfEditSecurity.NO_EDITand setsetOwnerPassword(String).- Returns:
- allow user form data value
-
setAllowUserFormData
public final void setAllowUserFormData(Boolean value)
Sets allow user form data. The permissions for users to fill-in (enter data into) forms in the PDF document.If AllowUserFormData is set false, the
setOwnerPassword(String)must be set for the security measure to take effect.Note. If you want to make the form readonly in Adobe Acrobat Reader please call
Security_Api.makePdfDocumentReadOnly(InternalPdfDocument, String)method or setsetAllowUserEdits(PdfEditSecurity)toPdfEditSecurity.NO_EDITand setsetOwnerPassword(String).- Parameters:
value- the value
-
getAllowUserPrinting
public final PdfPrintSecurity getAllowUserPrinting()
Gets allow user printing. The permissions for users to print the PDF document.If print rights are restricted, then the
setOwnerPassword(String)must be set for the security measure to take effect.- Returns:
- allow user printing value
-
setAllowUserPrinting
public final void setAllowUserPrinting(PdfPrintSecurity value)
Sets allow user printing. The permissions for users to print the PDF document.If print rights are restricted, then the
setOwnerPassword(String)must be set for the security measure to take effect.- Parameters:
value- the value
-
getOwnerPassword
public final String getOwnerPassword()
Gets owner password. The owner password and enables encryption of PDF content (algorithm per setEncryptionType, RC4 128-bit by default). An owner password is one used to enable and disable all other security settings.OwnerPassword must be set to a non empty string value for
setAllowUserCopyPasteContent(Boolean),setAllowUserAnnotations(Boolean),setAllowUserFormData(Boolean)andsetAllowUserEdits(PdfEditSecurity)to be restricted.- Returns:
- the owner password
-
setOwnerPassword
public final void setOwnerPassword(String value)
Sets owner password. The owner password and enables encryption of PDF content (algorithm per setEncryptionType, RC4 128-bit by default). An owner password is one used to enable and disable all other security settings.OwnerPassword must be set to a non empty string value for
setAllowUserCopyPasteContent(Boolean),setAllowUserAnnotations(Boolean),setAllowUserFormData(Boolean)andsetAllowUserEdits(PdfEditSecurity)to be restricted.- Parameters:
value- the value
-
getUserPassword
public final String getUserPassword()
Gets user password. The user password and enables encryption of PDF content (algorithm per setEncryptionType, RC4 128-bit by default).A user password is a password that each user must enter to open or print the PDF document.
- Returns:
- the user password
-
setUserPassword
public final void setUserPassword(String value)
Sets user password. The user password and enables encryption of PDF content (algorithm per setEncryptionType, RC4 128-bit by default).A user password is a password that each user must enter to open or print the PDF document.
- Parameters:
value- the value
-
getEncryptionType
public final PdfEncryptionType getEncryptionType()
Gets the encryption algorithm used when the document is secured with a password.Defaults to
PdfEncryptionType.RC4_128.- Returns:
- the encryption type
-
setEncryptionType
public final void setEncryptionType(PdfEncryptionType value)
Sets the encryption algorithm used when the document is secured with a password.Defaults to
PdfEncryptionType.RC4_128. Set toPdfEncryptionType.AES_128orPdfEncryptionType.AES_256for stronger, modern encryption.- Parameters:
value- the value
-
isEncryptMetadata
public final Boolean isEncryptMetadata()
Gets whether the document's metadata is encrypted along with its content.Defaults to true (the PDF default). Only honored for AES encryption; it has no effect for
PdfEncryptionType.RC4_128.- Returns:
- the encrypt metadata value
-
setEncryptMetadata
public final void setEncryptMetadata(Boolean value)
Sets whether the document's metadata is encrypted along with its content.Defaults to true (the PDF default). Only honored for AES encryption; it has no effect for
PdfEncryptionType.RC4_128. Set to false to keep metadata readable/indexable while the rest of the document remains encrypted.- Parameters:
value- the value
-
-