convertHtml method
Convert an html document to a pdf data
Implementation
@override
Future<Uint8List> convertHtml(
String html,
String? baseUrl,
PdfPageFormat format,
) async {
final job = _printJobs.add(
onHtmlRendered: Completer<Uint8List>(),
);
final params = <String, dynamic>{
'html': html,
'baseUrl': baseUrl,
'width': format.width,
'height': format.height,
'marginLeft': format.marginLeft,
'marginTop': format.marginTop,
'marginRight': format.marginRight,
'marginBottom': format.marginBottom,
'job': job.index,
};
await _channel.invokeMethod<void>('convertHtml', params);
final result = await job.onHtmlRendered!.future;
_printJobs.remove(job.index);
return result;
}