public void Print(PSPDFPrintBarButtonItem barButton) { try { if (UIPrintInteractionController.PrintingAvailable) { UIPrintInteractionController pic = UIPrintInteractionController.SharedPrintController; if (pic != null) { // PrintInfo UIPrintInfo printInfo = UIPrintInfo.PrintInfo; printInfo.OutputType = UIPrintInfoOutputType.General; printInfo.JobName = "Print Job: eBriefing"; printInfo.Duplex = UIPrintInfoDuplex.None; if (Orientation == ORIENTATION.LANDSCAPE) { printInfo.Orientation = UIPrintInfoOrientation.Landscape; } else { printInfo.Orientation = UIPrintInfoOrientation.Portrait; } pic.PrintInfo = printInfo; pic.ShowsNumberOfCopies = true; pic.ShowsPaperSelectionForLoadedPapers = true; pic.ShowsPageRange = false; pic.PrintPageRenderer = renderer; // Show print options pic.PresentFromBarButtonItem(barButton, true, (printController, completed, error) => { if (!completed && error != null) { Console.WriteLine("PrintHelper - Print Error Code " + error.Code); } renderer.Dispose(); renderer = null; dict.Clear(); dict = null; }); } } else { new UIAlertView(StringRef.alert, "Print is not available at this time.", null, StringRef.ok, null).Show(); } } catch (Exception ex) { Logger.WriteLineDebugging("PrintHelper - Print: {0}", ex.ToString()); } }
public PrintPanel(String bookID, PSPDFPrintBarButtonItem barButton, CGRect frame) : base(frame) { this.BackgroundColor = eBriefingAppearance.Gray5; this.bookID = bookID; this.barButton = barButton; this.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleHeight; Range = PrintHelper.RANGE.CURRENT; Orientation = PrintHelper.ORIENTATION.PORTRAIT; Annotation = PrintHelper.ANNOTATION.WITHOUT; Note = PrintHelper.NOTE.WITHOUT; // navBar UINavigationBar navBar = new UINavigationBar(); navBar.Frame = new CGRect(0, 0, this.Frame.Width, 44); this.AddSubview(navBar); // closeButton UIBarButtonItem closeButton = new UIBarButtonItem("Close", UIBarButtonItemStyle.Plain, HandleCloseTouchUpInside); closeButton.TintColor = eBriefingAppearance.BlueColor; UINavigationItem item = new UINavigationItem(); item.RightBarButtonItem = closeButton; item.Title = "Print Options"; navBar.PushNavigationItem(item, false); UIStringAttributes stringAttributes = new UIStringAttributes(); stringAttributes.StrokeColor = eBriefingAppearance.Gray3; stringAttributes.Font = eBriefingAppearance.ThemeRegularFont(17f); navBar.TitleTextAttributes = stringAttributes; // tableView UITableView tableView = new UITableView(new CGRect(0, navBar.Frame.Bottom + 1, this.Frame.Width, this.Frame.Height - navBar.Frame.Bottom - 1), UITableViewStyle.Grouped); tableView.BackgroundColor = UIColor.Clear; dataSource = new PrintDataSource(this); tableView.Source = dataSource; this.AddSubview(tableView); tableView.LayoutIfNeeded(); tableView.Frame = new CGRect(tableView.Frame.X, tableView.Frame.Y, tableView.Frame.Width, tableView.ContentSize.Height); // printView UIView printView = new UIView(new CGRect(0, tableView.Frame.Bottom + 30, this.Frame.Width, 44)); printView.BackgroundColor = UIColor.White; this.AddSubview(printView); // printButton UIButton printButton = UIButton.FromType(UIButtonType.Custom); printButton.Frame = new CGRect(0, 0, printView.Frame.Width, printView.Frame.Height); printButton.Font = eBriefingAppearance.ThemeRegularFont(17); printButton.SetTitle(StringRef.print, UIControlState.Normal); printButton.SetTitleColor(eBriefingAppearance.BlueColor, UIControlState.Normal); printButton.TouchUpInside += HandlePrintTouchUpInside; printView.AddSubview(printButton); // emailButton // UIButton emailButton = UIButton.FromType(UIButtonType.Custom); // emailButton.Frame = new CGRect(0,printView.Frame.Bottom+30 , printView.Frame.Width, printView.Frame.Height); // emailButton.Font = eBriefingAppearance.ThemeRegularFont(17); // emailButton.BackgroundColor = UIColor.White; // emailButton.SetTitle("Email", UIControlState.Normal); // emailButton.SetTitleColor(eBriefingAppearance.BlueColor, UIControlState.Normal); // emailButton.TouchUpInside += (object sender, EventArgs e) => // { // PrintSetup (true); // }; // // this.AddSubview(emailButton); }