node-zugferd
node-zugferd
@node-zugferd/validator-xsd
@node-zugferd/validator-mustang
@node-zugferd/traffiqx
@node-zugferd/templates
@node-zugferd/pdf-template
T
Align
F
aspectRatio
T
AssetSource
T
BackgroundImage
T
Border
T
BorderSides
I
BoxStyle
T
BoxTransform
T
BreakInside
F
brutalistTheme
F
button
I
ButtonOptions
T
CellVerticalAlign
F
checkbox
I
CheckboxOptions
F
cleanTheme
V
Colors
I
ColumnSpec
T
ColumnWidth
T
CrossAxis
F
definePdfTemplate
F
defineStyles
I
DocumentMetadata
F
dropdown
I
DropdownOptions
T
Edges
T
EdgesInput
F
editorialTheme
F
embedFont
F
flattenForm
F
flex
F
flowContinuation
I
FlowOptions
F
flowToPdf
I
FlowToPdfOptions
F
formatCurrency
I
FormFieldAppearance
T
FormFieldNode
T
FormFieldOptions
T
FormValue
T
Fragmentation
F
getFormValues
F
group
F
hex
F
hline
F
hstack
F
image
F
imageFit
F
inlineNode
I
InlineNodeRun
T
InlineVerticalAlign
T
Justify
F
keepTogether
F
link
F
linkRun
F
loadFont
I
LoadFontOptions
F
loadImage
T
MainAxis
I
MainAxisLayout
F
measure
F
measureContent
I
MeasureProfileEvent
T
Node
F
nodeAdapter
F
optionList
I
OptionListOptions
T
Overflow
F
pageContent
I
PageContext
F
pageInner
I
PageOptions
I
PageSize
V
PageSizes
F
paragraph
I
ParagraphFloat
I
ParagraphFloatLayout
T
ParagraphItem
I
ParagraphLayout
I
ParagraphProps
I
ParagraphRun
C
PDFDocument
C
PdfEncryptionError
T
PdfEncryptionErrorCode
I
PdfEncryptionOptions
C
PDFFont
C
PDFImage
C
PDFPage
I
PdfPermissions
T
Position
F
radioOption
I
RadioOptionOptions
T
RelativeLength
F
render
F
renderFlow
T
RenderFlowProfileCallback
I
RenderFlowProfileEvent
I
RenderOptions
F
renderToPdf
I
RenderToPdfOptions
F
resolveMainAxis
T
RGB
F
rgb255
F
run
F
savePdf
I
SavePdfOptions
F
setFormValues
I
Size
F
spacer
T
StandardFontFamily
F
standardFonts
E
StandardFonts
I
StandardFontSet
F
streamFlow
I
StreamFlowOptions
I
StreamPageContext
F
stripeTheme
F
svgPath
F
table
I
TableCell
T
TableCellInput
I
TableDivider
I
TableOptions
V
text
F
textField
I
TextFieldOptions
I
TextOptions
I
TextProps
I
TextRunStyle
I
Theme
I
ThemeColors
I
ThemedTextStyle
I
ThemeFonts
I
ThemeRadii
I
ThemeSpacing
I
ThemeType
T
TransformOrigin
F
vline
F
vstack
@node-zugferd/parser
@node-zugferd/magic-bytes
@node-zugferd/instrumentation
@node-zugferd/docx-template
@node-zugferd/default-template
@node-zugferd/data-types
@node-zugferd/core

PDFFont

Represents a font that has been embedded in a [[PDFDocument]].

Class PDFFont

class PDFFont implements default

Represents a font that has been embedded in a [[PDFDocument]].

Properties

doc

PDFDocument

The document to which this font belongs.

name

string

The name of this font.

ref

PDFRef

The unique reference assigned to this font within the document.

of

(ref: PDFRef, doc: PDFDocument, embedder: FontEmbedder) => PDFFont

NOTE: You probably don't want to call this method directly. Instead, consider using the [[PDFDocument.embedFont]] and [[PDFDocument.embedStandardFont]] methods, which will create instances of [[PDFFont]] for you.

Create an instance of [[PDFFont]] from an existing ref and embedder

Methods

embed

embed(): Promise<void>

NOTE: You probably don't need to call this method directly. The [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will automatically ensure all fonts get embedded.

Embed this font in its document.

Returns Promise<void>

Resolves when the embedding is complete.

encodeText

encodeText(text: string): PDFHexString

NOTE: You probably don't need to call this method directly. The [[PDFPage.drawText]] method will automatically encode the text it is given.

Encodes a string of text in this font.

Parameters

  • text: string The text to be encoded.

Returns PDFHexString

The encoded text as a hex string.

getCharacterSet

getCharacterSet(): number[]

Get the set of unicode code points that can be represented by this font.

Returns number[]

The set of unicode code points supported by this font.

heightAtSize

heightAtSize(size: number, options?: { descender?: boolean }): number

Measure the height of this font at a given size. For example:

const height = font.heightAtSize(24)

The options.descender value controls whether or not the font's descender is included in the height calculation.

Parameters

  • size: number The font size to be used for this measurement.
  • options?: { descender?: boolean } The options to be used when computing this measurement.

Returns number

The height of this font at the given size.

sizeAtHeight

sizeAtHeight(height: number): number

Compute the font size at which this font is a given height. For example:

const fontSize = font.sizeAtHeight(12)

Parameters

  • height: number The height to be used for this calculation.

Returns number

The font size at which this font is the given height.

widthOfTextAtSize

widthOfTextAtSize(text: string, size: number): number

Measure the width of a string of text drawn in this font at a given size. For example:

const width = font.widthOfTextAtSize('Foo Bar Qux Baz', 36)

Parameters

  • text: string The string of text to be measured.
  • size: number The font size to be used for this measurement.

Returns number

The width of the string of text when drawn in this font at the given size.


llms.txt
C
PdfEncryptionError

C
PDFImage

Represents an image that has been embedded in a [[PDFDocument]].

Edit on GitHubPrivacyImprint