printPDF method

Future<String?> printPDF(
  1. String pdfPath, {
  2. String x = '10',
  3. String y = '10',
})

Prints the first page of a PDF file from an absolute file path.

pdfPath – absolute path to the PDF file on the device. x, y – label origin coordinates.

Implementation

Future<String?> printPDF(
  String pdfPath, {
  String x = '10',
  String y = '10',
}) async {
  try {
    final String? result = await _channel.invokeMethod('printPDF', {
      'pdfPath': pdfPath,
      'x': x,
      'y': y,
    });
    return result;
  } on PlatformException catch (e) {
    throw 'Failed to print PDF: ${e.message}';
  }
}