printPDF method

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

Prints the first page of a PDF loaded from a Flutter asset.

The page is rendered to a bitmap before being sent to the printer. assetPath must be a valid key registered in pubspec.yaml assets, e.g. 'assets/document.pdf'.

Implementation

Future<String?> printPDF(
  String assetPath, {
  String x = '10',
  String y = '10',
}) async {
  final File pdfFile = await _pdfService.getPdfFileFromAssets(assetPath);
  return _repository.printPDF(pdfFile.path, x: x, y: y);
}