Hi Jean,
Thank you for contacting Syncfusion support.
Yes, it is possible to download PDF file in iOS device once the document is loaded in SfPdfViewer. The following code example illustrates how to download and open a PDF file in Android and iOS.
In pubspec.yaml
|
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
syncfusion_flutter_pdfviewer: ^19.3.56-beta
path_provider: ^2.0.7
open_file: ^3.2.1 |
In main.dart
|
class _MyHomePageState extends State {
List? documentBytes;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
actions: [IconButton(onPressed: () async {
if (documentBytes != null) {
final Directory directory = await getApplicationSupportDirectory();
final File file = File(directory.path + 'downloaded.pdf');
await file.writeAsBytes(documentBytes!, flush: true)
.whenComplete(() {
OpenFile.open(directory.path + 'downloaded.pdf');
});
}
}, icon: const Icon(Icons.download))
],
),
body: SfPdfViewer.network(
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
onDocumentLoaded: (details) async {
documentBytes = details.document.save();
},
)
);
}
} |
Please let us know if you have any questions.
Regards,
Dilli babu.