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

PDFImage

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

Class PDFImage

class PDFImage implements default

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

Properties

doc

PDFDocument

The document to which this image belongs.

height

number

The height of this image in pixels.

ref

PDFRef

The unique reference assigned to this image within the document.

width

number

The width of this image in pixels.

of

(ref: PDFRef, doc: PDFDocument, embedder: ImageEmbedder) => PDFImage

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

Create an instance of [[PDFImage]] 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 images get embedded.

Embed this image in its document.

Returns Promise<void>

Resolves when the embedding is complete.

scale

scale(factor: number): { height: number; width: number }

Compute the width and height of this image after being scaled by the given factor. For example:

image.width  // => 500
image.height // => 250

const scaled = image.scale(0.5)
scaled.width  // => 250
scaled.height // => 125

This operation is often useful before drawing an image with [[PDFPage.drawImage]] to compute the width and height options.

Parameters

  • factor: number The factor by which this image should be scaled.

Returns { height: number; width: number }

The width and height of the image after being scaled.

scaleToFit

scaleToFit(width: number, height: number): { height: number; width: number }

Get the width and height of this image after scaling it as large as possible while maintaining its aspect ratio and not exceeding the specified width and height. For example:

image.width  // => 500
image.height // => 250

const scaled = image.scaleToFit(750, 1000)
scaled.width  // => 750
scaled.height // => 375

The width and height parameters can also be thought of as the width and height of a box that the scaled image must fit within.

Parameters

  • width: number The bounding box's width.
  • height: number The bounding box's height.

Returns { height: number; width: number }

The width and height of the image after being scaled.

size

size(): { height: number; width: number }

Get the width and height of this image. For example:

const { width, height } = image.size()

Returns { height: number; width: number }

The width and height of the image.


llms.txt
C
PDFFont

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

C
PDFPage

Represents a single page of a [[PDFDocument]].

Edit on GitHubPrivacyImprint