private void PdfViewerControl_DocumentSaved(object sender, DocumentSaveInitiatedEventArgs args) { string filePath = DependencyService.Get <ISave>().Save(args.SaveStream as MemoryStream); string message = "The PDF has been saved to " + filePath; DependencyService.Get <IAlertView>().Show(message); }
private void PdfViewerControl_DocumentSaveInitiated(object sender, DocumentSaveInitiatedEventArgs args) { MemoryStream stream = args.SavedStream as MemoryStream; string root = null; string fileName = "sample.pdf"; if (Android.OS.Environment.IsExternalStorageEmulated) { root = Android.OS.Environment.ExternalStorageDirectory.ToString(); } else { root = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); } Java.IO.File directory = new Java.IO.File(root + "/Syncfusion"); directory.Mkdir(); Java.IO.File file = new Java.IO.File(directory, fileName); if (file.Exists()) { file.Delete(); } Java.IO.FileOutputStream outputStream = new Java.IO.FileOutputStream(file); outputStream.Write(stream.ToArray()); outputStream.Flush(); outputStream.Close(); AlertDialog.Builder alertDialog = new AlertDialog.Builder(mainView.Context); alertDialog.SetTitle("Save"); alertDialog.SetMessage("The modified document is saved in the below location. " + "\n" + file.Path); alertDialog.SetPositiveButton("OK", (senderAlert, e) => { }); Dialog dialog = alertDialog.Create(); dialog.Show(); }
private void PdfViewerControl_DocumentSaveInitiated(object sender, DocumentSaveInitiatedEventArgs args) { Stream stream = args.SaveStream as MemoryStream; string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string filepath = Path.Combine(path, "savedDocument.pdf"); FileStream outputFillStream = File.Open(filepath, FileMode.Create); stream.Position = 0; stream.CopyTo(outputFillStream); outputFillStream.Close(); UIAlertView alertview = new UIAlertView(); alertview.Frame = new CGRect(20, 100, 200, 200); alertview.Message = filepath; alertview.Title = "The modified document is saved in the below location."; alertview.AddButton("Ok"); alertview.Show(); }