Added new API contents with the release of version 2.6.0

master
zboris12 2024-08-10 22:18:30 +09:00
parent 672ca59e66
commit 7805d04d91
1 changed files with 45 additions and 8 deletions

53
API.md

@ -27,7 +27,7 @@ crls | Array\<Uint8Array\> | 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\<string\> | 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\<number\><br />:fork_and_knife:Uint8Array<br />:fork_and_knife:ArrayBuffer<br />:fork_and_knife:string | optional | The font's data for drawing text.<br />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)<br />Default: `StandardFonts.Helvetica`
color | string | optional | A Hex string of font color. :one:<br />Default: `#000`
opacity | number | optional | Valid value is from 0 to 1.<br />Default: `1`<br />:no_entry_sign:<ins>Not implemented yet</ins>
blendMode | string | optional | Valid value is one of the values in [PDFLib.BlendMode](https://pdf-lib.js.org/docs/api/enums/blendmode)<br />:no_entry_sign:<ins>Not implemented yet</ins>
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:<br />Default is `0`.
noBreaks | string | optional | A regular expression string that indicates which characters should not be used to break a word.<br />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\<number\><br />:fork_and_knife:Uint8Array<br />:fork_and_knife:ArrayBuffer<br />:fork_and_knife:string | required | The image's data.
imgType | string | required | The image's type, <ins>only support jpg and png</ins>
opacity | number | optional | Valid value is from 0 to 1.<br />Default: 1<br />:no_entry_sign:<ins>Not implemented yet</ins>
blendMode | string | optional | Valid value is one of the values in [PDFLib.BlendMode](https://pdf-lib.js.org/docs/api/enums/blendmode)<br />:no_entry_sign:<ins>Not implemented yet</ins>
## 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\<number\><br />:fork_and_knife:Uint8Array<br />:fork_and_knife:ArrayBuffer<br />:fork_and_knife:string | optional | The image's data.
imgType | string | optional | The image's type, <ins>only support jpg and png</ins>
text | string| optional | A text drawing for the signature, <ins>not implemented yet</ins>
fontData | PDFLib.StandardFonts<br />:fork_and_knife:Array\<number\><br />:fork_and_knife:Uint8Array<br />:fork_and_knife:ArrayBuffer<br />:fork_and_knife:string | optional | The font's data for drawing text, <ins>not implemented yet</ins>
pageidx | number<br />:fork_and_knife:string | optional | The index of a page where the signature will be placed.<br />A string can be used to indicate placing the signature on multiple pages. :one:<br />Default is `0`.
~~imgData~~ | Array\<number\><br />:fork_and_knife:Uint8Array<br />:fork_and_knife:ArrayBuffer<br />:fork_and_knife:string | optional | The image's data.<br />:x:**Deprecated**, use `imgInfo` instead.
~~imgType~~ | string | optional | The image's type, <ins>only support jpg and png</ins><br />: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: