private void Button_Clicked(object sender, System.EventArgs e) { var pdf = PDFManager.GeneratePDFFromView(mainGrid); var fileManager = DependencyService.Get <IFileIO>(); string filePath = Path.Combine(fileManager.GetMyDocumentsPath(), "testpdf.pdf"); DependencyService.Get <IPdfSave>().Save(pdf, filePath); DependencyService.Get <IPDFPreviewProvider>().TriggerPreview(filePath); }
private void PrintBtn_Clicked(object sender, EventArgs e) { //MemoryStream lMemoryStream = new MemoryStream(); //Package package = Package.Open(lMemoryStream, FileMode.Create); //XpsDocument doc = new XpsDocument(package); //XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(doc); //writer.Write(dp); //doc.Close(); //package.Close(); //var pdfXpsDoc = PdfSharp.Xps.XpsModel.XpsDocument.Open(lMemoryStream); //PdfSharp.Xps.XpsConverter.Convert(pdfXpsDoc, d.FileName, 0); var pdf = PDFManager.GeneratePDFFromView(myRentals); }
private async void GeneratePDF(object sender, EventArgs e) { PermissionStatus status = await GetPermissions(new Permissions.StorageWrite()); if (status == PermissionStatus.Granted) { var pdf = PDFManager.GeneratePDFFromView(mainGrid); DependencyService.Get <IPdfSave>().Save(pdf, "SinglePage.pdf"); } else if (status != PermissionStatus.Unknown) { await DisplayAlert("Storage Access Denied", "Try Again", "OK"); } }
private void GeneratePDF(object sender, EventArgs e) { var pdf = PDFManager.GeneratePDFFromView(mainGrid); DependencyService.Get <IPdfSave>().Save(pdf, "SinglePage.pdf"); }