Members
DecodeStream
- Source:
- License:
- Extracted from pdf.js
https://github.com/andreasgal/pdf.js
Copyright (c) 2011 Mozilla Foundation
Contributors: Andreas Gal
Chris G Jones Shaon Barman Vivien Nicolas <21@vingtetun.org> Justin D'Arcangelo Yury Delendik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Extracted from pdf.js
https://github.com/andreasgal/pdf.js
Copyright (c) 2011 Mozilla Foundation
Contributors: Andreas Gal
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
Type Definitions
ApiSwitchBody(pdf)
Parameters:
| Name | Type | Description |
|---|---|---|
pdf |
jsPDF |
PatternData
{Matrix|undefined} matrix
{Number|undefined} xStep
{Number|undefined} yStep
{Array.
Type:
- Object