Skip to content

添加文本水印

ComPDFKit ReactNative SDK 支持通过UI交互形式添加文本水印,在 CPDFConfiguration 中配置水印默认样式,例如默认文本、颜色、字体大小。

tsx
// 在配置中设置默认文本水印样式
ComPDFKit.getDefaultConfig({
  global: {
    watermark: {
      types: ['text', 'image'],
      text: 'ComPDFKit-RN',
      textColor: '#000000',
      textSize: 36,
      rotation: -45,
      opacity: 255,
    }
  }
})

// 通过API打开添加水印弹窗
await pdfReaderRef.current?.showAddWatermarkView({
  types: ['text', 'image'],
  text: 'ComPDFKit RN',
  textColor: '#000000',
  textSize: 36,
  rotation: -45,
  opacity: 255,
});