diff --git a/API.md b/API.md index 5498661..9098ebd 100644 --- a/API.md +++ b/API.md @@ -70,7 +70,8 @@ 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` +fontData | Array\
:fork_and_knife:Uint8Array
:fork_and_knife:ArrayBuffer
:fork_and_knife:[PDFLib.StandardFonts](https://pdf-lib.js.org/docs/api/enums/standardfonts) | optional | The font's data for drawing text.
See [PdfFonts.getEmbeddedFont](#getEmbeddedFont) for the default font. +subset | boolean | optional | Create font subset or not.
Set to true to reduce the size of pdf file. 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 @@ -257,7 +258,7 @@ sign(pdf, cypopt*opt*) :arrow_right: Promise\ Sign the pdf and returns the binary data. Name | Type | Attributes | Description --- | --- | --- | --- -pdf | PDFLib.PDFDocument|Array\|Uint8Array|ArrayBuffer|string | required | The target pdf. +pdf | PDFLib.PDFDocument
:fork_and_knife:Array\
:fork_and_knife:Uint8Array
:fork_and_knife:ArrayBuffer
:fork_and_knife:string | required | The target pdf. cypopt | [EncryptOption](#EncryptOption) | optional | The informations of encryption. ## TsaFetcher @@ -293,6 +294,25 @@ Name | Type | Attributes | Description --- | --- | --- | --- data | string | required | The data needs to be signed. +## PdfFonts +:croissant::croissant::croissant: +### Static Methods +#### from +from(pdfdoc) :arrow_right: Promise\<[PdfFonts](#PdfFonts)\> +Load embedded fonts from pdf document. +Name | Type | Attributes | Description +--- | --- | --- | --- +pdfdoc | PDFLib.PDFDocument | required | The target pdf document. + +### Methods +#### getEmbeddedFont +getEmbeddedFont(fontData*opt*, subset*opt*) :arrow_right: Promise\ +Get the embedded font or create one if not exists. +Name | Type | Attributes | Description +--- | --- | --- | --- +fontData | Array\
:fork_and_knife:Uint8Array
:fork_and_knife:ArrayBuffer
:fork_and_knife:[PDFLib.StandardFonts](https://pdf-lib.js.org/docs/api/enums/standardfonts) | optional | Data of font. If omitted,
the default font is `PDFLib.StandardFonts.Helvetica` if there is no existing embedded font.
Or the default font is the first existing embedded font. +subset | boolean | optional | Create font subset or not. + ## Note * __CRL__:loudspeaker: Certificate Revocation List * __DSS__:loudspeaker: Document Security Store