tsplPrintPDF method

  1. @override
Future<void> tsplPrintPDF(
  1. String filePath,
  2. LabelSize labelSize
)
override

Prints a PDF file by specifying the file path and label size.

  • filePath: Path to the PDF file.
  • labelSize: Label dimensions (e.g., "78x60").

Implementation

@override
Future<void> tsplPrintPDF(String filePath, LabelSize labelSize) async {
  if (_isPrinting) {
    print('[Flutter] Skipping print, already in progress');
    return;
  }

  _isPrinting = true;
  try {
    print('[Flutter] Calling tspl_printPDF...');
    await _channel.invokeMethod('tspl_printPDF', {
      'filePath': filePath,
      'label': labelSize.value,
    });
  } catch (e) {
    print('[Flutter] Error printing: $e');
  } finally {
    _isPrinting = false;
  }
}