public class PdfEncryptionProperties extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
CONTENT_COPYING_ALLOWED_DEFAULT
The default value of isContentCopyingAllowed()
|
static boolean |
EDITING_ALLOWED_DEFAULT
The default value of isEditingAllowed()
|
static boolean |
PRINTING_ALLOWED_DEFAULT
The default value of isPrintingAllowed()
|
static boolean |
SCREEN_READER_ACCESS_ALLOWED_DEFAULT
The default value of isScreenReaderAccessAllowed()
|
Constructor and Description |
---|
PdfEncryptionProperties() |
Modifier and Type | Method and Description |
---|---|
byte[] |
getOwnerPassword()
Gets owner password bytes
|
byte[] |
getUserPassword()
Gets user password bytes
|
boolean |
isContentCopyingAllowed()
Gets whether it is possible to copy content from PDF when it is opened with user permissions
|
boolean |
isEditingAllowed()
Gets whether it is possible to edit content in PDF (including annotations) when it is opened with user permissions
|
boolean |
isPrintingAllowed()
Gets whether it is possible to print PDF when it is opened with user permissions
|
boolean |
isScreenReaderAccessAllowed()
Gets whether it is possible for screen reader to access content in PDF when it is opened with user permissions
|
PdfEncryptionProperties |
setContentCopyingAllowed(boolean contentCopyingAllowed)
Sets whether it is possible to copy content from PDF when it is opened with user permissions
|
PdfEncryptionProperties |
setEditingAllowed(boolean editingAllowed)
Sets whether it is possible to edit content in PDF (including annotations) when it is opened with user permissions
|
PdfEncryptionProperties |
setOwnerPassword(byte[] ownerPassword)
Sets owner password from raw bytes
|
PdfEncryptionProperties |
setOwnerPassword(String ownerPassword)
Sets owner password from String
|
PdfEncryptionProperties |
setPrintingAllowed(boolean printingAllowed)
Sets whether it is possible to print PDF when it is opened with user permissions
|
PdfEncryptionProperties |
setScreenReaderAccessAllowed(boolean screenReaderAccessAllowed)
Sets whether it is possible for screen reader to access content in PDF when it is opened with user permissions
|
PdfEncryptionProperties |
setUserPassword(byte[] userPassword)
Sets user password from raw bytes
|
PdfEncryptionProperties |
setUserPassword(String userPassword)
Sets user password from String
|
public static final boolean PRINTING_ALLOWED_DEFAULT
isPrintingAllowed()
public static final boolean CONTENT_COPYING_ALLOWED_DEFAULT
isContentCopyingAllowed()
public static final boolean EDITING_ALLOWED_DEFAULT
isEditingAllowed()
public static final boolean SCREEN_READER_ACCESS_ALLOWED_DEFAULT
isScreenReaderAccessAllowed()
public byte[] getOwnerPassword()
If encryption is used, owner password must be not null
and not empty There are no restrictions when working with PDF opened with owner permissions
public PdfEncryptionProperties setOwnerPassword(byte[] ownerPassword)
Note: Use this if you know what's you are doing, for most cases consider using setOwnerPassword(String)
instead.
If encryption is used, owner password must be not null
and not empty There are no restrictions when working with PDF opened with owner permissions
ownerPassword
- owner password bytes
PdfEncryptionProperties
class for chaining
public PdfEncryptionProperties setOwnerPassword(String ownerPassword)
String
Conversion to byte array is performed according to ISO-32000-1 7.6.4.3.3 Algorithm 2.A: Retrieving the file encryption key from an encrypted document in order to decrypt it (revision 6 and later): the SASLPrep (RFC 4013) profile of StringPrep (RFC 3454) is applied first using the Normalize and BiDi options, then conversion to a UTF-8 representation is performed.
If encryption is used, owner password must be not null
and not empty There are no restrictions when working with PDF opened with owner permissions
ownerPassword
- owner password string
PdfEncryptionProperties
class for chaining
public byte[] getUserPassword()
If null
or empty is treated as absent.
If absent PDF document can be opened with user permissions without any password.
The isContentCopyingAllowed()
, isEditingAllowed()
, isPrintingAllowed()
, isScreenReaderAccessAllowed()
are indicating what is allowed, when PDF is opened with user permissions
public PdfEncryptionProperties setUserPassword(byte[] userPassword)
Note: Use this if you know what's you are doing, for most cases consider using setUserPassword(String)
instead.
If null
or empty is treated as absent.
If absent PDF document can be opened with user permissions without any password.
The isContentCopyingAllowed()
, isEditingAllowed()
, isPrintingAllowed()
, isScreenReaderAccessAllowed()
are indicating what is allowed, when PDF is opened with user permissions
userPassword
- user password bytes
PdfEncryptionProperties
class for chaining
public PdfEncryptionProperties setUserPassword(String userPassword)
String
Conversion to byte array is performed according to ISO-32000-1 7.6.4.3.3 Algorithm 2.A: Retrieving the file encryption key from an encrypted document in order to decrypt it (revision 6 and later): the SASLPrep (RFC 4013) profile of StringPrep (RFC 3454) is applied first using the Normalize and BiDi options, then conversion to a UTF-8 representation is performed.
If null
or empty is treated as absent.
If absent PDF document can be opened with user permissions without any password.
The isContentCopyingAllowed()
, isEditingAllowed()
, isPrintingAllowed()
, isScreenReaderAccessAllowed()
are indicating what is allowed, when PDF is opened with user permissions
userPassword
- user password string
PdfEncryptionProperties
class for chaining
public boolean isPrintingAllowed()
Is PRINTING_ALLOWED_DEFAULT
by default
true
if printing is allowed, otherwise false
public PdfEncryptionProperties setPrintingAllowed(boolean printingAllowed)
Is PRINTING_ALLOWED_DEFAULT
by default
printingAllowed
- true
if it is possible to print PDF, otherwise false
PdfEncryptionProperties
class for chaining
public boolean isContentCopyingAllowed()
Is CONTENT_COPYING_ALLOWED_DEFAULT
by default
true
if content is allowed to copy, otherwise false
public PdfEncryptionProperties setContentCopyingAllowed(boolean contentCopyingAllowed)
Is CONTENT_COPYING_ALLOWED_DEFAULT
by default
contentCopyingAllowed
- true
to allow to copy content, otherwise false
PdfEncryptionProperties
class for chaining
public boolean isEditingAllowed()
Is EDITING_ALLOWED_DEFAULT
by default
true
if editing is allowed, otherwise false
public PdfEncryptionProperties setEditingAllowed(boolean editingAllowed)
Is EDITING_ALLOWED_DEFAULT
by default
editingAllowed
- true
to allow to edit, otherwise false
PdfEncryptionProperties
class for chaining
public boolean isScreenReaderAccessAllowed()
Is SCREEN_READER_ACCESS_ALLOWED_DEFAULT
by default
true
if screen reader access is allowed, otherwise false
public PdfEncryptionProperties setScreenReaderAccessAllowed(boolean screenReaderAccessAllowed)
Is SCREEN_READER_ACCESS_ALLOWED_DEFAULT
by default
screenReaderAccessAllowed
- true
to allow screen reader access, otherwise false
PdfEncryptionProperties
class for chaining
Copyright © 2024. All rights reserved.