validateForCreate method
Validates the watermark before creating it in a document.
Returns null when the watermark can be created, or an error message
describing the first validation failure.
Implementation
String? validateForCreate() {
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) {
if (imagePath.trim().isEmpty) {
return 'Image watermark path cannot be empty.';
}
if (!File(imagePath).existsSync()) {
return 'Image watermark path does not exist.';
}
}
return null;
}