Images and Dividers

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

PDF images are managed editable resources. Use insertImageAsync() for a URL, UUID, base64 string, or blob source, or use the detached builder for staged insertion.

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. Relative URL paths are not accepted as URL sources; 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() is detached and does not modify the PDF. Pass its result to insertImage(). Update an existing managed image through its live setSource(), transform, crop, and opacity methods.

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 use PDF points. getStroke() returns a detached snapshot, and setStroke() replaces the stroke without changing 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.