[]
Use this class to specify passwords and permissions for a PDF document, such as whether the document can be printed, modified, annotated, or have its content extracted. These settings can be applied through PdfSaveOptions.setSecurityOptions(PdfSecurityOptions) when saving a workbook to PDF.
Use high-entropy, unique passwords from secure configuration or a key management service. Do not hard-code PDF passwords in application code.
PdfSecurityOptions securityOptions = new PdfSecurityOptions();
securityOptions.setUserPassword(getPdfUserPassword());
securityOptions.setOwnerPassword(getPdfOwnerPassword());
securityOptions.setPrintPermission(false);
securityOptions.setExtractContentPermission(false);
PdfSaveOptions options = new PdfSaveOptions();
options.setSecurityOptions(securityOptions);
workbook.save(new ByteArrayOutputStream(), options);
booleangetModifyDocumentPermission() is not set.booleanbooleanbooleanbooleanbooleanbooleanvoidsetAssembleDocumentPermission(boolean value) getModifyDocumentPermission() is not set.voidsetExtractContentPermission(boolean value) voidsetFillFormsPermission(boolean value) voidsetFullQualityPrintPermission(boolean value) voidsetModifyAnnotationsPermission(boolean value) voidsetModifyDocumentPermission(boolean value) voidsetOwnerPassword(String value) voidsetPrintPermission(boolean value) voidsetUserPassword(String value) toString()This password is used to open the exported PDF document when a user password has been specified through setUserPassword(String).
Use a high-entropy, unique password from secure configuration or a key management service. Do not hard-code this value in application code.
PdfSecurityOptions options = new PdfSecurityOptions();
String configuredUserPassword = getPdfUserPassword();
options.setUserPassword(configuredUserPassword);
String userPassword = options.getUserPassword();
null if no user password has been set.Use a high-entropy, unique password from secure configuration or a key management service. Do not hard-code this value in application code.
PdfSecurityOptions options = new PdfSecurityOptions();
String configuredUserPassword = getPdfUserPassword();
options.setUserPassword(configuredUserPassword);
value - The user password of the PDF document, or null if no user password has been set.The owner password is required to change the permissions for the PDF document when these security options are applied during PDF export.
Use a high-entropy, unique password from secure configuration or a key management service. Do not hard-code this value in application code.
PdfSecurityOptions options = new PdfSecurityOptions();
String configuredOwnerPassword = getPdfOwnerPassword();
options.setOwnerPassword(configuredOwnerPassword);
String ownerPassword = options.getOwnerPassword();
null if no owner password has been set.The owner password is required to change the permissions for the PDF document when these security options are applied during PDF export.
Use a high-entropy, unique password from secure configuration or a key management service. Do not hard-code this value in application code.
PdfSecurityOptions options = new PdfSecurityOptions();
String configuredOwnerPassword = getPdfOwnerPassword();
options.setOwnerPassword(configuredOwnerPassword);
value - The owner password for the PDF document, or null if no owner password has been set.This property controls whether the generated PDF can be printed. The default value is true.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setPrintPermission(false);
boolean allowPrint = options.getPrintPermission();
true if printing the PDF document is allowed; otherwise, false.This property controls whether the generated PDF can be printed. The default value is true.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setPrintPermission(false);
value - true if printing the PDF document is allowed; otherwise, false.This property indicates whether users are allowed to modify the exported PDF document. The default value is true.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setModifyDocumentPermission(false);
boolean allowModifyDocument = options.getModifyDocumentPermission();
true if modifying the PDF document is permitted; otherwise, false.This property indicates whether users are allowed to modify the exported PDF document. The default value is true.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setModifyDocumentPermission(false);
value - true if modifying the PDF document is permitted; otherwise, false.This property indicates whether annotations can be added or modified in the exported PDF.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setModifyAnnotationsPermission(false);
boolean allowAnnotations = options.getModifyAnnotationsPermission();
true if commenting on the document is permitted; otherwise, false.This property indicates whether annotations can be added or modified in the exported PDF.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setModifyAnnotationsPermission(false);
value - true if commenting on the document is permitted; otherwise, false.This property indicates whether form fields can be filled in the exported PDF. According to the product documentation, this permission can still allow form filling even when getModifyAnnotationsPermission() returns false.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setModifyAnnotationsPermission(false);
options.setFillFormsPermission(true);
boolean allowFillForms = options.getFillFormsPermission();
true if filling form fields is permitted; otherwise, false.This property indicates whether form fields can be filled in the exported PDF. According to the product documentation, this permission can still allow form filling even when getModifyAnnotationsPermission() Sets false.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setModifyAnnotationsPermission(false);
options.setFillFormsPermission(true);
value - true if filling form fields is permitted; otherwise, false.This property indicates whether PDF content can be copied or extracted. Use setExtractContentPermission(boolean) to enable or disable this permission.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setExtractContentPermission(false);
boolean allowExtractContent = options.getExtractContentPermission();
true if copying or extracting PDF content is permitted; otherwise, false.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setExtractContentPermission(false);
value - true if copying or extracting PDF content is permitted; otherwise, false.getModifyDocumentPermission() is not set.This property indicates whether PDF document assembly operations are allowed. Use setAssembleDocumentPermission(boolean) to enable or disable this permission.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setAssembleDocumentPermission(false);
boolean canAssemble = options.getAssembleDocumentPermission();
true if inserting, rotating, or deleting pages and creating bookmarks or thumbnail images is permitted; otherwise, false.getModifyDocumentPermission() is not set.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setAssembleDocumentPermission(false);
value - true if inserting, rotating, or deleting pages and creating bookmarks or thumbnail images is permitted; otherwise, false.This property indicates whether the generated PDF allows faithful, high-quality printing.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setFullQualityPrintPermission(true);
boolean allowHighQualityPrint = options.getFullQualityPrintPermission();
true if high-quality printing is allowed; otherwise, false.This property indicates whether the generated PDF allows faithful, high-quality printing.
PdfSecurityOptions options = new PdfSecurityOptions();
options.setFullQualityPrintPermission(true);
value - true if high-quality printing is allowed; otherwise, false.