validateForUpdate method

String? validateForUpdate()

Validates the watermark before updating it in a document.

Returns null when the watermark can be updated, or an error message describing the first validation failure.

Implementation

String? validateForUpdate() {
  final pagesError = _validatePages();
  if (pagesError != null) {
    return pagesError;
  }
  if (type == CPDFWatermarkType.text && textContent.trim().isEmpty) {
    return 'Text watermark content cannot be empty.';
  }
  if (type == CPDFWatermarkType.image &&
      imagePath.trim().isNotEmpty &&
      !File(imagePath).existsSync()) {
    return 'Image watermark path does not exist.';
  }
  return null;
}