Back to Jspdf

Global

docs/global.html

4.2.17.2 KB
Original Source

Methods

addMetadata(metadata, rawXmlOrNamespaceUri) → {jsPDF}

Source:

Adds XMP formatted metadata to PDF.

WARNING: Passing raw XML is potentially insecure! Always sanitize user input before passing it to this function!

Parameters:
NameTypeDescription
metadatastring

The actual metadata to be added. The interpretation of this parameter depends on the second parameter.

| | rawXmlOrNamespaceUri | boolean | string | undefined |

If a string is passed it sets the namespace URI for the metadata and the metadata shall be stored as XMP simple value. The last character should be a slash or hash.

If this argument is omitted, a string is passed, or false is passed, the metadata argument will be XML-escaped before including it in the PDF.

If true is passed, the metadata argument will be interpreted as raw XMP and will be included verbatim in the PDF. The passed metadata must be complete (including surrounding xmpmeta and RDF tags).

|

Returns:

jsPDF-instance

Type jsPDF

constructor(permissions, userPassword, ownerPassword, fileId)

Source:

Initializes encryption settings

Example
var security = new PDFSecurity(["print"])
Parameters:
NameTypeDescription
permissionsArray

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:
NameTypeDescription
objectIdnumber
generationnumber

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:
NameTypeDescription
hexString

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:
NameTypeDescription
datanumber

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:

processOwnerPassword(paddedUserPassword, paddedOwnerPassword) → {String}

Source:

Computes the 'O' field in the encryption dictionary

Parameters:
NameTypeDescription
paddedUserPasswordString

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:
NameTypeDescription
keystring

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:

Author:

License:

  • Use it if you like it

A class to parse color values

Sets options for Bidi conversion(:)

Source:

Parameters:
NameTypeDescription
:Object
  • isInputVisual {boolean} (defaults to false): allowed values: true(Visual mode), false(Logical mode)
  • isInputRtl {boolean}: allowed values true(Right-to-left direction), false (Left-to-right directiion), undefined(Contectual direction, i.e.direction defined by first strong character of input string)
  • isOutputVisual {boolean} (defaults to false): allowed values: true(Visual mode), false(Logical mode)
  • isOutputRtl {boolean}: allowed values true(Right-to-left direction), false (Left-to-right directiion), undefined(Contectual direction, i.e.direction defined by first strong characterof input string)
  • isSymmetricSwapping {boolean} (defaults to false): allowed values true(needs symmetric swapping), false (no need in symmetric swapping),

|

toHexString(byteString) → {String}

Source:

Converts a byte string to a hex string

Parameters:
NameTypeDescription
byteStringString

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:
NameTypeDescription
str

Type Definitions

ApiSwitchBody(pdf)

Source:

Parameters:
NameTypeDescription
pdfjsPDF

PatternData

Source:

{Matrix|undefined} matrix {Number|undefined} xStep {Number|undefined} yStep {Array.|undefined} boundingBox

Type:
  • Object