Ein umfassendes Flutter-Paket zur Verarbeitung von PDF-Drucken auf verschiedenen Plattformen und Geräten mit Unterstützung für verschiedene Druckertypen wie ESC/POS, Sunmi, Bluetooth, USB und Systemdrucker.
Aus öffentlichen Paketdaten erstellte Orientierung.
Quick Print ist ein vielseitiges Flutter-Paket, das für eine nahtlose PDF-Druckfunktion auf mehreren Plattformen wie Android, iOS, macOS, Windows und Linux entwickelt wurde. Es unterstützt eine breite Palette an Druckern wie ESC/POS, Sunmi, Bluetooth, USB und Systemdrucker und ermöglicht Entwicklern die effiziente Erstellung und Übertragung von Druckaufträgen. Das Paket vereinfacht die plattformübergreifende Druckfunktion durch konsistente APIs und starke Gerätekompatibilität. Ideal für Einzelhandels-, Kassen- (POS) und Dokumentenverwaltungsanwendungen, die zuverlässige Druckfunktionen erfordern.
Anwendungsfälle
Einzelhandelsbelegdruck
POS-System-Integration
Dokumenten-Stapelbedruckung
Mobile-App-Berichterstattung
Plattformübergreifendes Drucken
Hauptmerkmale
Multiplattform-Unterstützung
ESC/POS- und Bluetooth-Druckerkompatibilität
PDF-Erstellung und Druck
USB- und Systemdruckerintegration
Druckauftragsverwaltung über Geräte hinweg
Geeignet für
POS-Anwendungsentwickler
Einzelhandel-Software-Teams
Mobile App-Entwickler, die Drucken benötigen
Dokumentenautomatisierungsprojekte
Plattformübergreifende Drucklösungen
Hinweise
Plattformspezifische Einrichtung erforderlich
Beschränkte Dokumentation für erweiterte Funktionen
Die Bluetooth-Paarung kann Benutzerintervention erfordern
Verfügbarkeit des Druckertreibers für das Zielbetriebssystem
Testen über mehrere Geräte wird empfohlen
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
Quick Print
A comprehensive Flutter package for handling PDF printing across different platforms and devices. This package provides a unified interface for printing PDFs using various printer types, including ESC/POS, Sunmi, Bluetooth, USB, and system printers.
Features
🖨️ Multi-printer Support
Sunmi printer support for Android devices
Bluetooth printer integration (including BLE)
USB printer compatibility
Desktop system printer support
Mobile device printing
🖼️ Image Printing Support
Print images (Uint8List) directly to any supported printer
📄 Paper Size Options
80mm paper width (POS printers)
58mm paper width (Thermal printers)
A4 paper size
🎯 Platform Support
Android
iOS
Windows
Linux
macOS
🔍 Printer Discovery
Discover Bluetooth, BLE, USB, and desktop printers
Unified API for managing discovered printers
🛠️ Error Handling
Custom exceptions for invalid files, unconnected devices, and unsupported operations
Getting Started
Add this to your package's pubspec.yaml file:
dependencies:quick_print:<LASTEST_VERSION>
Then run:
flutter pub get
Usage
Basic Usage
import'package:quick_print/quick_print.dart';
// Create a printer instancefinal printer = QuickPrint(PrinterDeviceType.mobile);
// Print a PDF fileawait printer.instance.print(
path: 'assets/document.pdf',
paperSize: PaperSize.a4,
);
// Print an image (as Uint8List)final imageBytes = awaitFile('assets/image.png').readAsBytes();
await printer.instance.printImage(
bytes: imageBytes,
paperSize: PaperSize.a4,
);
Printer Discovery
The PrinterDiscoveryService class allows you to discover printers on various platforms.
import'package:quick_print/quick_print.dart';
final discoveryService = PrinterDiscoveryService();
// Initialize the service (required for BLE on Windows)await discoveryService.initialize();
// Discover printersawait discoveryService.discoverDevices();
// List discovered printersfinal printers = discoveryService.printerDevicesList;
printers.forEach((printer) {
print('Discovered printer: ${printer.name}');
});
// Dispose of the service when done
discoveryService.dispose();
Bluetooth Printer
import'package:quick_print/quick_print.dart';
// Create a Bluetooth printer modelfinal bluetoothModel = BluetoothPrinterModel(
name: 'Thermal Printer',
address: '00:11:22:33:44:55',
isBle: false,
);
// Create a printer instancefinal printer = QuickPrint(PrinterDeviceType.bluetooth);
// Print with the Bluetooth printerawait printer.instance.print(
path: 'assets/receipt.pdf',
paperSize: PaperSize.mm80,
model: bluetoothModel,
);
USB Printer
import'package:quick_print/quick_print.dart';
// Create a USB printer modelfinal usbModel = UsbPrinterModel(
name: 'POS-58',
productId: '0x0483',
vendorId: '0x5740',
);
// Create a printer instancefinal printer = QuickPrint(PrinterDeviceType.usb);
// Print with the USB printerawait printer.instance.print(
path: 'assets/receipt.pdf',
paperSize: PaperSize.mm58,
model: usbModel,
);
Platform-specific Setup
Android
Add the following permissions to your AndroidManifest.xml:
<!-- For Bluetooth printers --><uses-permissionandroid:name="android.permission.BLUETOOTH"/><uses-permissionandroid:name="android.permission.BLUETOOTH_ADMIN"/><uses-permissionandroid:name="android.permission.BLUETOOTH_CONNECT"/><uses-permissionandroid:name="android.permission.BLUETOOTH_SCAN"/><!-- For USB printers --><uses-featureandroid:name="android.hardware.usb.host"/>
iOS
Add the following to your Info.plist:
<key>UISupportedExternalAccessoryProtocols</key><array><string>com.printer.protocol</string></array><!-- For Bluetooth printers --><key>NSBluetoothAlwaysUsageDescription</key><string>Need BT access for printing</string><key>NSBluetoothPeripheralUsageDescription</key><string>Need BT access for printing</string>