# StandardSecurityHandlerRev2

## Content

# Class: StandardSecurityHandlerRev2

Defines Standard Security Handler Revision 2.
This handler uses RC4 encryption with key 40 bit length.

## Extends

- [`StandardSecurityHandler`](StandardSecurityHandler)

## Extended by

- [`StandardSecurityHandlerRev3`](StandardSecurityHandlerRev3)

## Accessors

### accessType

#### Get Signature

```ts
get accessType(): AccessType;
```

Gets the access type granted by this [StandardSecurityHandler](StandardSecurityHandler), or null.
This property is initialized when a document is loaded.

##### Returns

[`AccessType`](../enumerations/AccessType)

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`accessType`](StandardSecurityHandler#accesstype)

***

### allowCopyContent

#### Get Signature

```ts
get allowCopyContent(): boolean;
```

Gets or sets whether the user can copy contents from the PDF document.

##### Returns

`boolean`

#### Set Signature

```ts
set allowCopyContent(value): void;
```

Gets or sets whether the user can copy contents from the PDF document.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### allowEditAnnotations

#### Get Signature

```ts
get allowEditAnnotations(): boolean;
```

Gets or sets whether the user can edit annotations in the PDF document.

##### Returns

`boolean`

#### Set Signature

```ts
set allowEditAnnotations(value): void;
```

Gets or sets whether the user can edit annotations in the PDF document.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### allowEditContent

#### Get Signature

```ts
get allowEditContent(): boolean;
```

Gets or sets whether the user can edit the contents of the PDF document.

##### Returns

`boolean`

#### Set Signature

```ts
set allowEditContent(value): void;
```

Gets or sets whether the user can edit the contents of the PDF document.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### allowPrint

#### Get Signature

```ts
get allowPrint(): boolean;
```

Gets or sets whether the user can print the PDF document.

##### Returns

`boolean`

#### Set Signature

```ts
set allowPrint(value): void;
```

Gets or sets whether the user can print the PDF document.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### id

#### Get Signature

```ts
get id(): number;
```

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`id`](StandardSecurityHandler#id)

***

### om

#### Get Signature

```ts
get om(): ObjectManager;
```

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`om`](StandardSecurityHandler#om)

***

### ownerPassword

#### Get Signature

```ts
get ownerPassword(): string;
```

Gets or sets the password required to change permissions of a PDF document as a string.
The two properties [ownerPassword](StandardSecurityHandler#ownerpassword) and [ownerPasswordBytes](StandardSecurityHandler#ownerpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Returns

`string`

#### Set Signature

```ts
set ownerPassword(value): void;
```

Gets or sets the password required to change permissions of a PDF document as a string.
The two properties [ownerPassword](StandardSecurityHandler#ownerpassword) and [ownerPasswordBytes](StandardSecurityHandler#ownerpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Parameters

###### value

`string`

##### Returns

`void`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`ownerPassword`](StandardSecurityHandler#ownerpassword)

***

### ownerPasswordBytes

#### Get Signature

```ts
get ownerPasswordBytes(): Uint8Array;
```

Gets or sets the password required to change permissions of a PDF document as a byte array.
The two properties [ownerPassword](StandardSecurityHandler#ownerpassword) and [ownerPasswordBytes](StandardSecurityHandler#ownerpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Returns

`Uint8Array`

#### Set Signature

```ts
set ownerPasswordBytes(value): void;
```

Gets or sets the password required to change permissions of a PDF document as a byte array.
The two properties [ownerPassword](StandardSecurityHandler#ownerpassword) and [ownerPasswordBytes](StandardSecurityHandler#ownerpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Parameters

###### value

`Uint8Array`

##### Returns

`void`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`ownerPasswordBytes`](StandardSecurityHandler#ownerpasswordbytes)

***

### passwordMatches

#### Get Signature

```ts
get passwordMatches(): PasswordMatches;
```

Gets a combination of flags that indicate how the password specified
when loading the PDF matches the document's User and Owner passwords.

##### Returns

[`PasswordMatches`](../enumerations/PasswordMatches)

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`passwordMatches`](StandardSecurityHandler#passwordmatches)

***

### revision

#### Get Signature

```ts
get revision(): number;
```

Gets the revision of this [StandardSecurityHandler](StandardSecurityHandler).

##### Returns

`number`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`revision`](StandardSecurityHandler#revision)

***

### userPassword

#### Get Signature

```ts
get userPassword(): string;
```

Gets or sets the password required to open a PDF document as a string.
The two properties [userPassword](StandardSecurityHandler#userpassword) and [userPasswordBytes](StandardSecurityHandler#userpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdf cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using [userPasswordBytes](StandardSecurityHandler#userpasswordbytes).

##### Returns

`string`

#### Set Signature

```ts
set userPassword(value): void;
```

Gets or sets the password required to open a PDF document as a string.
The two properties [userPassword](StandardSecurityHandler#userpassword) and [userPasswordBytes](StandardSecurityHandler#userpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdf cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using [userPasswordBytes](StandardSecurityHandler#userpasswordbytes).

##### Parameters

###### value

`string`

##### Returns

`void`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`userPassword`](StandardSecurityHandler#userpassword)

***

### userPasswordBytes

#### Get Signature

```ts
get userPasswordBytes(): Uint8Array;
```

Gets or sets the password required to open a PDF document as a byte array.
The two properties [userPassword](StandardSecurityHandler#userpassword) and [userPasswordBytes](StandardSecurityHandler#userpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Returns

`Uint8Array`

#### Set Signature

```ts
set userPasswordBytes(value): void;
```

Gets or sets the password required to open a PDF document as a byte array.
The two properties [userPassword](StandardSecurityHandler#userpassword) and [userPasswordBytes](StandardSecurityHandler#userpasswordbytes) allow
to define the password as a string or as an array of bytes.
According to the PDF specification, a string password should be converted to an array of bytes
using the system code page (if the standard security handler with revision 4 or less is used).
In some environments the system code page is unavailable, so DsPdfJS cannot perform this conversion.
If the password string only contains ASCII chars, this does not present a problem.
But if the password string contains non-ASCII Unicode characters, it is up to the developer
to perform the conversion and set the password using this property.

##### Parameters

###### value

`Uint8Array`

##### Returns

`void`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`userPasswordBytes`](StandardSecurityHandler#userpasswordbytes)

## Methods

### create()

```ts
static create(om?): StandardSecurityHandlerRev2;
```

Creates a new StandardSecurityHandlerRev2.

#### Parameters

##### om?

[`ObjectManager`](ObjectManager)

[ObjectManager](ObjectManager) that controls the lifetime of the StandardSecurityHandlerRev2.

#### Returns

`StandardSecurityHandlerRev2`

***

### assignFrom()

```ts
assignFrom(source): void;
```

Copies all property values from another object.

#### Parameters

##### source

[`SecurityHandlerBase`](SecurityHandlerBase)

The source object.

#### Returns

`void`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`assignFrom`](StandardSecurityHandler#assignfrom)

***

### clone()

```ts
clone(): SecurityHandlerBase;
```

Create copy of this [SecurityHandlerBase](SecurityHandlerBase).

#### Returns

[`SecurityHandlerBase`](SecurityHandlerBase)

The clone of this object.

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`clone`](StandardSecurityHandler#clone)

***

### free()

```ts
free(): void;
```

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`free`](StandardSecurityHandler#free)

***

### rebind()

```ts
rebind(omTo): void;
```

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`StandardSecurityHandler`](StandardSecurityHandler).[`rebind`](StandardSecurityHandler#rebind)
