Skip to content
ComPDF
Guides

Watermark

ComPDFKit_Tools provides watermark functionality, supporting both text and image watermarks.

Entry Configuration

Access watermark settings via the "watermark" item in the More menu:

json
{
  "toolbarConfig": {
    "availableMenus": [
      "watermark"
    ]
  }
}

Watermark Configuration

Preset default watermark properties via GlobalConfig's watermarkConfig:

json
{
  "global": {
    "watermarkConfig": {
      "watermarkType": "text",
      "text": "ComPDFKit",
      "textColor": "#000000",
      "textColorAlpha": 128,
      "fontSize": 48,
      "isBold": false,
      "isItalic": false,
      "rotation": -45,
      "opacity": 0.5,
      "scale": 1.0,
      "isFront": true,
      "isTile": false,
      "horizontalSpacing": 50,
      "verticalSpacing": 50
    }
  }
}
FieldDescription
watermarkTypeWatermark type: "text" or "image"
textText watermark content
textColorText color
textColorAlphaText opacity (0-255)
fontSizeFont size
isBoldWhether bold
isItalicWhether italic
rotationRotation angle (degrees)
opacityOverall opacity (0.0-1.0)
scaleScale ratio
isFrontWhether on page foreground (true) or background (false)
isTileWhether to tile
horizontalSpacingTile horizontal spacing
verticalSpacingTile vertical spacing

CWatermarkEditDialog

CWatermarkEditDialog is the watermark editing dialog, located in the com.compdfkit.tools.security.watermark package.

Features

  • Create text watermarks
  • Create image watermarks
  • Real-time watermark preview
  • Adjust watermark position, rotation, opacity, and other properties
  • Set tile mode
ComponentDescription
CWatermarkEditDialogWatermark editing dialog
CWatermarkTextWidgetText watermark editing widget
CWatermarkImageWidgetImage watermark editing widget