Beispiel #1
0
        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());
            }
        }
Beispiel #2
0
        public string GeneratePageRender(bool bGeneratePdf = false)
        {
            try
            {
                renderer = new PageRenderer(Orientation, dict);

                if (bGeneratePdf)
                {
                    return(GeneratePdf());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("PrintHelper Exception" + ex.Message);
                return(null);
            }
        }