Skip to content
Guides

Edit Text and Image Properties

ComPDFKit supports to modify the properties of text and images.

Edit Text Properties

ComPDFKit supports modifying text properties, such as text font size, name, color, alignment, italic, bold, transparency, etc when you are in content editor mode. The following code shows you how to set text to 22px, black, bold, font Times-Roman, and opacity 60.

ComPDFKit for Web supports Helvetica, Courier, Times Roman, and DroidSansFallbackFull font family. DroidSansFallbackFull font is a font family that supports Chinese, Japanese, Korean, and other fonts.

javascript
const editAnnotations = await docViewer.contentEditAnnotationsManager.getEditAnnotation(1);
editAnnotation[0].setTextStyle({
  color: '#000000',
  opacity: 60,
  fontSize: 22,
  fontFamily: 'Times-Roman',
  fontStyle: 'bold'
});

Edit Image Properties

ComPDFKit supports modifying image properties, such as rotating, cropping, mirroring, and setting transparency.

This example shows how to rotate an image and set it to semi-transparent:

javascript
const editAnnotation = await docViewer.contentEditAnnotationsManager.getEditAnnotation(1)[0];
editAnnotation.setTextStyle({
  color: '#000000',
  opacity: 60,
  fontSize: 22,
  fontFamily: 'Times-Roman',
  fontStyle: 'bold'
});