generateAndOpenPdf method

Future<bool> generateAndOpenPdf({
  1. required LokotroPayOnResponse paymentResponse,
  2. String? merchantName,
  3. String? merchantAddress,
  4. String? customerName,
  5. String? customerEmail,
  6. Map<String, dynamic>? additionalInfo,
  7. String? fileName,
})

Generate and save PDF with automatic opening

Implementation

Future<bool> generateAndOpenPdf({
  required LokotroPayOnResponse paymentResponse,
  String? merchantName,
  String? merchantAddress,
  String? customerName,
  String? customerEmail,
  Map<String, dynamic>? additionalInfo,
  String? fileName,
}) async {
  try {
    final pdfBytes = await generatePaymentReceipt(
      paymentResponse: paymentResponse,
      merchantName: merchantName,
      merchantAddress: merchantAddress,
      customerName: customerName,
      customerEmail: customerEmail,
      additionalInfo: additionalInfo,
    );

    return await savePdfAndOpen(pdfBytes, fileName: fileName);
  } catch (e) {
    return false;
  }
}