import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:path_provider/path_provider.dart';

// Function to save PDF file on mobile platforms
Future<File> savePdfFile(String fileName, Uint8List bytes) async {
  final directory = await getApplicationDocumentsDirectory();
  final filePath = '${directory.path}/$fileName';
  final file = File(filePath);
  await file.writeAsBytes(bytes);
  debugPrint('PDF Laporan Diagnosis disimpan di: $filePath');
  return file;
} 