Skip to main content
Version: Version 5

Interface: Image

Interface representing the image provided by the PDF renderer.

The image contains a pixel buffer and dimensions. On high-DPI displays, the buffer contains more pixels than the logical dimensions indicate.

Example: A 500x500 logical image with devicePixelRatio=2 has:

  • Logical size: 500x500 (used for layout/positioning)
  • Buffer size: 1000x1000 pixels (used for sharp rendering)
  • Buffer length: 1000 * 1000 * 4 = 4,000,000 bytes (RGBA)

Properties

buffer

buffer: ArrayBuffer

Raw RGBA pixel data. Size = (width * dpr) * (height * dpr) * 4 bytes.


devicePixelRatio?

optional devicePixelRatio?: number

Device Pixel Ratio (DPR) used when rendering this image. The actual buffer dimensions are (width * dpr) x (height * dpr). Defaults to 1 if not specified.


height

height: number

Height in logical pixels (used for layout/positioning, unaffected by DPR).


width

width: number

Width in logical pixels (used for layout/positioning, unaffected by DPR).