Methods
constructor(permissions, userPassword, ownerPassword, fileId)
- Source:
Initializes encryption settings
Example
var security = new PDFSecurity(["print"])
Parameters:
Name | Type | Description |
---|---|---|
permissions |
Array | Permissions allowed for user, "print", "modify", "copy" and "annot-forms". |
userPassword |
String | Permissions apply to this user. Leaving this empty means the document is not password protected but viewer has the above permissions. |
ownerPassword |
String | Owner has full functionalities to the file. |
fileId |
String | As hex string, should be same as the file ID in the trailer. |
encryptor(objectId, generation) → {function}
- Source:
Returns an encryptor function which can take in a byte string and returns the encrypted version
Example
out("stream");
encryptor = security.encryptor(object.id, 0);
out(encryptor(data));
out("endstream");
Parameters:
Name | Type | Description |
---|---|---|
objectId |
number | |
generation |
number | Not sure what this is for, you can set it to 0 |
Returns:
- Type
- function
hexToBytes(hex) → {String}
- Source:
Converts a hex string to a byte string
Parameters:
Name | Type | Description |
---|---|---|
hex |
String | Hex string |
Returns:
- Type
- String
lsbFirstWord(data) → {Array}
- Source:
Breaks down a 4-byte number into its individual bytes, with the least significant bit first
Parameters:
Name | Type | Description |
---|---|---|
data |
number | 32-bit number |
Returns:
- Type
- Array
mapArrayBufferViews()
- Source:
Helper function that maps ArrayBufferViews to ArrayBuffers Used by BlobBuilder constructor and old browsers that didn't support it in the Blob constructor.
md5cycle()
- Source:
- License:
- Joseph Myers does not specify a particular license for his work. Author: Joseph Myers Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js Modified by: Owen Leong
processOwnerPassword(paddedUserPassword, paddedOwnerPassword) → {String}
- Source:
Computes the 'O' field in the encryption dictionary
Parameters:
Name | Type | Description |
---|---|---|
paddedUserPassword |
String | Byte string of padded user password |
paddedOwnerPassword |
String | Byte string of padded owner password |
Returns:
- Type
- String
rc4(key, data) → {string}
- Source:
Converts a byte string to a hex string
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Byte string of encryption key |
data |
string | Byte string of data to be encrypted |
Returns:
Encrypted string
- Type
- string
repeat()
- Source:
- License:
- FPDF is released under a permissive license: there is no usage restriction. You may embed it freely in your application (commercial or not), with or without modifications. Reference: http://www.fpdf.org/en/script/script37.php
RGBColor()
- Source:
- License:
- Use it if you like it
A class to parse color values
Sets options for Bidi conversion(:)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
: |
Object |
|
toHexString(byteString) → {String}
- Source:
Converts a byte string to a hex string
Parameters:
Name | Type | Description |
---|---|---|
byteString |
String | Byte string |
Returns:
- Type
- String
toPDFName(str)
- Source:
Convert string to PDF Name Object
.
Detail: PDF Reference 1.3 - Chapter 3.2.4 Name Object
Parameters:
Name | Type | Description |
---|---|---|
str |
Type Definitions
ApiSwitchBody(pdf)
Parameters:
Name | Type | Description |
---|---|---|
pdf |
jsPDF |
PatternData
{Matrix|undefined} matrix
{Number|undefined} xStep
{Number|undefined} yStep
{Array.
Type:
- Object