public async Task <bool> Print(int rowId) { bool success = false; try { if (this.PrintDocs?.Count > 0) { PdfService PdfService = new PdfService(); List <Param> param = new List <Param>(); if (this.RenderAsFilterDialog) { foreach (KeyValuePair <string, EbMobileControl> pair in this.ControlDictionary) { EbMobileControl ctrl = pair.Value; if (ctrl is IFileUploadControl || ctrl is EbMobileDataGrid) { continue; } param.Add(new Param { Name = ctrl.Name, Type = ((int)ctrl.EbDbType).ToString(), Value = Convert.ToString(ctrl.GetValue()) }); } } else { param.Add(new Param { Name = "id", Type = ((int)EbDbTypes.Int32).ToString(), Value = rowId.ToString() }); } ReportRenderResponse r = null; if (NetworkType == NetworkMode.Online) { if (!Utils.IsNetworkReady(this.NetworkType)) { Utils.Alert_NoInternet(); return(false); } r = await PdfService.GetPdfOnline(this.PrintDocs[0].ObjRefId, JsonConvert.SerializeObject(param)); } else if (NetworkType == NetworkMode.Offline) { r = PdfService.GetPdfOffline(this.PrintDocs[0].ObjRefId, JsonConvert.SerializeObject(param)); } if (r?.ReportBytea != null) { INativeHelper helper = DependencyService.Get <INativeHelper>(); string root = App.Settings.AppDirectory; string path = helper.NativeRoot + $"/{root}/{AppConst.SHARED_MEDIA}/{App.Settings.Sid.ToUpper()}/PDF{(DateTime.UtcNow.ToString("yyyyMMddHHmmss"))}.pdf"; File.WriteAllBytes(path, r.ReportBytea); IAppHandler handler = DependencyService.Get <IAppHandler>(); string res = await handler.PrintPdfFile(path); if (res != "success") { await Launcher.OpenAsync(new OpenFileRequest { File = new ReadOnlyFile(path) }); } success = true; } } } catch (Exception ex) { Utils.Toast("Error: " + ex.Message); EbLog.Error("Error in [EbMobileForm.Print] " + ex.Message + " " + ex.StackTrace); } return(success); }