getBackground method
Gets the current document background configuration.
Returns null when the document has no background. Native SDKs do not
expose the source image of an existing image background, so
CPDFBackground.imagePath is null for values returned by this method.
Since v3.2.0
example:
final background = await controller.document.getBackground();
if (background != null) {
debugPrint('Background type: ${background.type}');
debugPrint('Background pages: ${background.pages}');
}
Implementation
Future<CPDFBackground?> getBackground() async {
//TODO: Android, iOS pages 返回为空
final result = await _channel.invokeMethod('get_background');
if (result is! Map) {
return null;
}
return CPDFBackground.fromJson(Map<String, dynamic>.from(result));
}