diff --git a/API.md b/API.md index 73c7479..deeb009 100644 --- a/API.md +++ b/API.md @@ -27,7 +27,7 @@ crls | Array\ | optional | The array of [CRL](#note)s. Name | Type | Attributes | Description --- | --- | --- | --- -mode | [Crypto.Mode](#Crypto.Mode) | required | The mode of encryption +mode | [Crypto.Mode](#CryptoMode) | required | The mode of encryption permissions | Array\ | optional | The set of permissions to be blocked :one: userpwd | string | optional | User password. Used when opening the pdf. ownerpwd | string | optional | Owner password. If not specified, a random value is used. @@ -60,8 +60,43 @@ Name | Type | Attributes | Description --- | --- | --- | --- x | number | required | Distance from left y | number | required | Distance from top -w | number | required | Width -h | number | required | Height +w | number | optional | Width +h | number | optional | Height + +## SignTextInfo +:taco::taco::taco: + +Name | Type | Attributes | Description +--- | --- | --- | --- +text | string | required | A text to draw. +size | number | required | Font size +fontData | Array\
:fork_and_knife:Uint8Array
:fork_and_knife:ArrayBuffer
:fork_and_knife:string | optional | The font's data for drawing text.
If it is a string, it is assumed to be one of the values in [PDFLib.StandardFonts](https://pdf-lib.js.org/docs/api/enums/standardfonts)
Default: `StandardFonts.Helvetica` +color | string | optional | A Hex string of font color. :one:
Default: `#000` +opacity | number | optional | Valid value is from 0 to 1.
Default: `1`
:no_entry_sign:Not implemented yet +blendMode | string | optional | Valid value is one of the values in [PDFLib.BlendMode](https://pdf-lib.js.org/docs/api/enums/blendmode)
:no_entry_sign:Not implemented yet +lineHeight | number | optional | Default is the height of the font at the given size. +xOffset | number | optional | An offset from [SignAreaInfo](#signareainfo)'s x. +yOffset | number | optional | An offset from [SignAreaInfo](#signareainfo)'s y. +wMax | number | optional | The max width for drawing text. +align | number | optional | Alignment of text. :two:
Default is `0`. +noBreaks | string | optional | A regular expression string that indicates which characters should not be used to break a word.
Default: `[A-Za-z0-9]` + +:one: Value of `color` can be [6-digit](https://htmlcolorcodes.com/) or 3-digit. And `#` can be omitted. + +:two: `align` can be the values listed blow. + * `0`: left + * `1`: center + * `2`: right + +## SignImageInfo +:taco::taco::taco: + +Name | Type | Attributes | Description +--- | --- | --- | --- +imgData | Array\
:fork_and_knife:Uint8Array
:fork_and_knife:ArrayBuffer
:fork_and_knife:string | required | The image's data. +imgType | string | required | The image's type, only support jpg and png +opacity | number | optional | Valid value is from 0 to 1.
Default: 1
:no_entry_sign:Not implemented yet +blendMode | string | optional | Valid value is one of the values in [PDFLib.BlendMode](https://pdf-lib.js.org/docs/api/enums/blendmode)
:no_entry_sign:Not implemented yet ## SignDrawInfo :taco::taco::taco: @@ -69,11 +104,13 @@ h | number | required | Height Name | Type | Attributes | Description --- | --- | --- | --- area | [SignAreaInfo](#signareainfo) | required | The signature's drawing area, these numbers are dots on 72dpi. -pageidx | number | optional | The index of a page where the signature will be drawn. Default is 0. -imgData | Array\
:fork_and_knife:Uint8Array
:fork_and_knife:ArrayBuffer
:fork_and_knife:string | optional | The image's data. -imgType | string | optional | The image's type, only support jpg and png -text | string| optional | A text drawing for the signature, not implemented yet -fontData | PDFLib.StandardFonts
:fork_and_knife:Array\
:fork_and_knife:Uint8Array
:fork_and_knife:ArrayBuffer
:fork_and_knife:string | optional | The font's data for drawing text, not implemented yet +pageidx | number
:fork_and_knife:string | optional | The index of a page where the signature will be placed.
A string can be used to indicate placing the signature on multiple pages. :one:
Default is `0`. +~~imgData~~ | Array\
:fork_and_knife:Uint8Array
:fork_and_knife:ArrayBuffer
:fork_and_knife:string | optional | The image's data.
:x:**Deprecated**, use `imgInfo` instead. +~~imgType~~ | string | optional | The image's type, only support jpg and png
:x:**Deprecated**, use `imgInfo` instead. +imgInfo | [SignImageInfo](#signimageinfo) | optional | Image's informations for drawing. +textInfo | [SignTextInfo](#signtextinfo) | optional | Text's informations for drawing. + +:one: For example: A pdf contains 17 pages and specify `"-3,5-7,9,12,15-"` to `pageidx` means `[0,1,2,3,5,6,7,9,12,15,16]`. ## SignOption :taco::taco::taco: