Skip to content

PngImage ​

Defined in: components/image/png.ts:9

Implements ​

Constructor components/image/png.ts:20 ​

new PngImage(source, options?): PngImage

Parameters ​

ParameterType
sourceany
options?ImageOptions

Returns ​

PngImage

Properties ​

PropertyModifierType
align
png.ts:13
public"left" | "center" | "right"
height?
png.ts:12
publicnumber
source
png.ts:10
publicany
width?
png.ts:11
publicnumber

Methods ​

draw() components/image/png.ts:51 ​

draw(writer, x, y, width, availableHeight, _context): Component | null

Draws the component (or a part of it) on the page.

Parameters ​

ParameterTypeDescription
writerPDFPageWriterThe page writer to issue commands to.
xnumberThe current relative X coordinate from the left margin.
ynumberThe current relative Y coordinate from the bottom margin (top boundary of the element).
widthnumberThe width constraint allocated to this element.
availableHeightnumberThe height constraint representing remaining space on the current page.
_contextLayoutContext-

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 ​

Component.draw

measure() components/image/png.ts:46 ​

measure(_width, _context): object

Returns the width and height required by this component when rendered within a given width constraint.

Parameters ​

ParameterType
_widthnumber
_contextLayoutContext

Returns ​

object

NameType
height
png.ts:46
number
width
png.ts:46
number

Implementation of ​

Component.measure

Released under the MIT License.