Images and Dividers

Insert managed images, update image resources, and add vector dividers to PDF pages.

PDF images are managed, editable resources. Pass a URL, UUID, base64 string, or blob source to insertImageAsync(), or use the detached builder to insert in stages.

Insert an image

TypeScript
const image = await page.insertImageAsync(  'https://example.com/assets/signature.png',  {    left: 36,    top: 36,    width: 144,    height: 72,    opacity: 0.9,  })image.setRotation(-4).bringToFront()

Automatic source detection recognizes absolute http and https URLs. It does not accept a relative path as a URL source, so use an absolute URL, a valid managed-resource UUID, or base64 data.

Use the image builder

TypeScript
const imageInfo = page  .newImage()  .setSource('https://example.com/assets/chart.png')  .setAbsolutePosition(216, 36)  .setSize(240, 135)  .setOpacity(0.85)  .build()const chart = page.insertImage(imageInfo)

build() operates on a detached object and does not modify the PDF. Pass the result to insertImage(). To update an existing managed image, use the live setSource() method and the live transform, crop, and opacity methods.

Crop an image

Select an image, open the properties inspector, and choose Crop image. Drag the crop area or its corners to set the visible window, optionally with a fixed ratio, then apply the crop. The crop is durable and participates in undo and redo.

FPdfImage.getCrop() returns the crop window in PDF points, measured from the top-left corner of the image frame, or null when the image is uncropped. setCrop({ left, top, right, bottom }) applies the same coordinates and requires right > left and bottom > top. It throws a RangeError for non-finite or empty rectangles.

Crop values stay relative to the image frame, so resizing or rotating the image keeps the same visible region.

Add a divider

TypeScript
const divider = page.insertDivider({  left: 36,  top: 144,  width: 420,  strokeWidth: 1,})divider.setStroke({  width: 2,  color: '#3366ff',})

Divider geometry and stroke lengths are measured in PDF points. getStroke() returns a detached snapshot, and setStroke() replaces the stroke without modifying the geometry.

FPdfImage also exposes getSource(), getImageSourceType(), setSource(), getCrop(), setCrop(), getOpacity(), setOpacity(), and remove(). Image opacity must be between 0 and 1.

How is this guide?

© 2026 DreamNum Co., Ltd.