Method from org.apache.pdfbox.pdmodel.encryption.PDStandardEncryption Detail: |
public boolean canAssembleDocument() {
return isPermissionBitOn( ASSEMBLE_DOCUMENT_BIT );
} Deprecated!This will tell if the user can insert/rotate/delete pages. |
public boolean canExtractContent() {
return isPermissionBitOn( EXTRACT_BIT );
} Deprecated!This will tell if the user can extract text and images from the PDF document. |
public boolean canExtractForAccessibility() {
return isPermissionBitOn( EXTRACT_FOR_ACCESSIBILITY_BIT );
} Deprecated!This will tell if the user can extract text and images from the PDF document
for accessibility purposes. |
public boolean canFillInForm() {
return isPermissionBitOn( FILL_IN_FORM_BIT );
} Deprecated!This will tell if the user can fill in interactive forms. |
public boolean canModify() {
return isPermissionBitOn( MODIFICATION_BIT );
} Deprecated!This will tell if the user can modify contents of the document. |
public boolean canModifyAnnotations() {
return isPermissionBitOn( MODIFY_ANNOTATIONS_BIT );
} Deprecated!This will tell if the user can add/modify text annotations, fill in interactive forms fields. |
public boolean canPrint() {
return isPermissionBitOn( PRINT_BIT );
} Deprecated!This will tell if the user can print. |
public boolean canPrintDegraded() {
return isPermissionBitOn( DEGRADED_PRINT_BIT );
} Deprecated!This will tell if the user can print the document in a degraded format. |
public byte[] getOwnerKey() {
byte[] o = null;
COSString owner = (COSString)encryptionDictionary.getDictionaryObject( COSName.getPDFName( "O" ) );
if( owner != null )
{
o = owner.getBytes();
}
return o;
} Deprecated!This will get the O entry in the standard encryption dictionary. |
public int getPermissions() {
int permissions = 0;
COSInteger p = (COSInteger)encryptionDictionary.getDictionaryObject( COSName.getPDFName( "P" ) );
if( p != null )
{
permissions = p.intValue();
}
return permissions;
} Deprecated!This will get the permissions bit mask. |
public int getRevision() {
int revision = DEFAULT_VERSION;
COSNumber cosRevision = (COSNumber)encryptionDictionary.getDictionaryObject( COSName.getPDFName( "R" ) );
if( cosRevision != null )
{
revision = cosRevision.intValue();
}
return revision;
} Deprecated!This will return the R entry of the encryption dictionary.
See PDF Reference 1.4 Table 3.14. |
public byte[] getUserKey() {
byte[] u = null;
COSString user = (COSString)encryptionDictionary.getDictionaryObject( COSName.getPDFName( "U" ) );
if( user != null )
{
u = user.getBytes();
}
return u;
} Deprecated!This will get the U entry in the standard encryption dictionary. |
public void setCanAssembleDocument(boolean allowAssembly) {
setPermissionBit( ASSEMBLE_DOCUMENT_BIT, allowAssembly );
} Deprecated!Set if the user can insert/rotate/delete pages. |
public void setCanExtractContent(boolean allowExtraction) {
setPermissionBit( EXTRACT_BIT, allowExtraction );
} Deprecated!Set if the user can extract content from the document. |
public void setCanExtractForAccessibility(boolean allowExtraction) {
setPermissionBit( EXTRACT_FOR_ACCESSIBILITY_BIT, allowExtraction );
} Deprecated!Set if the user can extract content from the document for accessibility purposes. |
public void setCanFillInForm(boolean allowFillingInForm) {
setPermissionBit( FILL_IN_FORM_BIT, allowFillingInForm );
} Deprecated!Set if the user can fill in interactive forms. |
public void setCanModify(boolean allowModifications) {
setPermissionBit( MODIFICATION_BIT, allowModifications );
} Deprecated!Set if the user can modify the document. |
public void setCanModifyAnnotations(boolean allowAnnotationModification) {
setPermissionBit( MODIFY_ANNOTATIONS_BIT, allowAnnotationModification );
} Deprecated!Set if the user can modify annotations. |
public void setCanPrint(boolean allowPrinting) {
setPermissionBit( PRINT_BIT, allowPrinting );
} Deprecated!Set if the user can print. |
public void setCanPrintDegraded(boolean allowAssembly) {
setPermissionBit( DEGRADED_PRINT_BIT, allowAssembly );
} Deprecated!Set if the user can print the document in a degraded format. |
public void setOwnerKey(byte[] o) throws IOException {
COSString owner = new COSString();
owner.append( o );
encryptionDictionary.setItem( COSName.getPDFName( "O" ), owner );
} Deprecated!This will set the O entry in the standard encryption dictionary. |
public void setPermissions(int p) {
encryptionDictionary.setInt( COSName.getPDFName( "P" ), p );
} Deprecated!This will set the permissions bit mask. |
public void setRevision(int revision) {
encryptionDictionary.setInt( COSName.getPDFName( "R" ), revision );
} Deprecated!This will set the R entry of the encryption dictionary.
See PDF Reference 1.4 Table 3.14.
Note: This value is used to decrypt the pdf document. If you change this when
the document is encrypted then decryption will fail!. |
public void setUserKey(byte[] u) throws IOException {
COSString user = new COSString();
user.append( u );
encryptionDictionary.setItem( COSName.getPDFName( "U" ), user );
} Deprecated!This will set the U entry in the standard encryption dictionary. |