Image
Defined in: components/image/index.ts:21
Auto-detecting image component. Accepts JPEG, PNG, or SVG source and delegates to the appropriate typed class internally.
For explicit typing, use JpegImage, PngImage, or Svg.
Implements
Constructor components/image/index.ts:29
new Image(
source,options?):Image
Parameters
| Parameter | Type |
|---|---|
source | any |
options? | ImageOptions |
Returns
Image
Properties
| Property | Modifier | Type |
|---|---|---|
align?index.ts:25 | public | "left" | "center" | "right" |
height?index.ts:24 | public | number |
sourceindex.ts:22 | public | any |
width?index.ts:23 | public | number |
Methods
draw() components/image/index.ts:117
draw(
writer,x,y,width,availableHeight,context):Component|null
Draws the component (or a part of it) on the page.
Parameters
| Parameter | Type | Description |
|---|---|---|
writer | PDFPageWriter | The page writer to issue commands to. |
x | number | The current relative X coordinate from the left margin. |
y | number | The current relative Y coordinate from the bottom margin (top boundary of the element). |
width | number | The width constraint allocated to this element. |
availableHeight | number | The height constraint representing remaining space on the current page. |
context | LayoutContext | The layout configuration context. |
Returns
Component | null
A new Component representing the remainder of this component if it could not finish rendering, or null if it rendered completely.
Implementation of
measure() components/image/index.ts:113
measure(
width,context):object
Returns the width and height required by this component when rendered within a given width constraint.
Parameters
| Parameter | Type |
|---|---|
width | number |
context | LayoutContext |
Returns
object
| Name | Type |
|---|---|
heightindex.ts:113 | number |
widthindex.ts:113 | number |
Implementation of
detect() components/image/index.ts:61
staticdetect(source,options?):Component
Detect image type and return the appropriate typed component.
Parameters
| Parameter | Type |
|---|---|
source | any |
options? | ImageOptions |
Returns
fromUrl() components/image/index.ts:40
staticfromUrl(url,options?):Promise<Component>
Parameters
| Parameter | Type |
|---|---|
url | string |
options? | ImageOptions |
Returns
Promise<Component>