示例#1
0
        static protected void RenderToPDF(ControllerContext ctx, string pathToView)
        {
            Report   report = new Report(new PdfFormatter());
            FontDef  fd     = new FontDef(report, "Courier");
            FontProp fp     = new FontPropMM(fd, 11 / 4);
            Page     page   = new Page(report);

            string html = RenderViewToString(ctx, pathToView, null, true);

            string[] lines  = html.Split('\n');
            int      lineNo = 0;

            foreach (var line in lines)
            {
                page.AddLT_MM(0, lineNo, new RepString(fp, line));
                lineNo += (int)(4 * 1.5);
            }

#if DEBUG
            RT.ViewPDF(report);
#else
            RT.ResponsePDF(report, System.Web.HttpContext.Current.Response);
            //RT.ResponsePDF(report, page);
#endif
        }
示例#2
0
 //------------------------------------------------------------------------------------------08.11.2004
 /// <summary>This method will start the selected sample.</summary>
 /// <param name="oSender">Sender</param>
 /// <param name="ea">Event argument</param>
 private void Action_Start(Object oSender, EventArgs ea)
 {
     if (radioButton_FlowLayoutManager.Checked)
     {
         RT.ViewPDF(new FlowLayoutManagerSample(), "FlowLayoutManagerSample.pdf");
     }
     else if (radioButton_Test.Checked)
     {
         RT.ViewPDF(new Test(), "Test.pdf");
     }
     else if (radioButton_Image.Checked)
     {
         RT.ViewPDF(new ImageSample(), "ImageSample.pdf");
     }
     else if (radioButton_ListLayoutManager.Checked)
     {
         RT.ViewPDF(new ListLayoutManagerSample(), "ListLayoutManagerSample.pdf");
     }
     else if (radioButton_PdfProperties.Checked)
     {
         RT.ViewPDF(new PdfPropertiesSample(), "PdfPropertiesSample.pdf");
     }
     else if (radioButton_TableLayoutManager.Checked)
     {
         RT.ViewPDF(new TableLayoutManagerSample(), "TableLayoutManagerSample.pdf");
     }
     else if (radioButton_Text.Checked)
     {
         RT.ViewPDF(new TextSample(), "TextSample.pdf");
     }
 }
        public void Report(int skillId, string level)
        {
            int rate = 1;

            switch (level)
            {
            case "Novice":
                rate = 1; break;

            case "Intermediate":
                rate = 2; break;

            case "Advanced":
                rate = 3;
                break;
            }
            var ratings        = _ratingService.GetSkillRatings(skillId).Where(r => r.Value == rate);
            var ratingEntities = ratings as IList <RatingEntity> ?? ratings.ToList();
            var users          = new List <UserReportModel>();

            foreach (var rating in ratingEntities)
            {
                var user       = _userService.GetUserEntity(rating.UserId);
                var userReport = new UserReportModel()
                {
                    Login = user.Login,
                    Email = user.Email,
                    Level = rating.Value
                };
                users.Add(userReport);
            }
            RT.ViewPDF(new ReportTableLayout(users), "KnowledgeManagerReport.pdf");
        }
示例#4
0
   //------------------------------------------------------------------------------------------14.02.2006
   /// <summary>Starts the "Start Template" sample.</summary>
   /// <remarks>This method serves only to start the application.</remarks>
   public static void Main()
   {
 #if Framework2
       PdfReport <StartTemplate> pdfReport = new PdfReport <StartTemplate>();
       pdfReport.pageLayout = PageLayout.SinglePage;
       pdfReport.View("StartTemplate.pdf");
 #else
       RT.ViewPDF(new StartTemplate(), "StartTemplate.pdf");
 #endif
   }
示例#5
0
        // Public Methods
        public void begin()
        {
            DialogResult      result;
            string            message;
            string            caption;
            MessageBoxButtons buttons;
            SaveFileDialog    ss = new SaveFileDialog();

            ss.Filter = "PDF files(*.pdf) | *.pdf | All files(*.*) | *.*";

            if (decklist.getCardCount() == 0)
            {
                message = "Your deck contains 0 cards. I cannot generate a pdf with 0 cards...";
                caption = "Error Detected in Input";
                buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, caption, buttons);
            }
            else if (decklist.getCardCount() % 6 != 0)
            {
                message = "There are pages with empty space. Consider adding " + (6 - decklist.getCardCount() % 6) + " more cards.\nPress Cancel to abort.\nPress OK to continue.";
                caption = "Error Detected in Input";
                buttons = MessageBoxButtons.OKCancel;
                result  = MessageBox.Show(message, caption, buttons);

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    if (ss.ShowDialog() == DialogResult.OK)
                    {
                        pdfOutput doc = new pdfOutput();
                        doc.decklist = decklist;
                        doc.Run();
                        RT.ViewPDF(doc, ss.FileName);
                    }
                }
            }
            else
            {
                if (ss.ShowDialog() == DialogResult.OK)
                {
                    pdfOutput doc = new pdfOutput();
                    doc.decklist = decklist;
                    doc.Run();
                    RT.ViewPDF(doc, ss.FileName);
                }
            }
        }
        public void loadData()
        {
            PdfFormatter pf = new PdfFormatter();

            pf.sTitle           = "PDF Sample";
            pf.sAuthor          = "Otto Mayer, [email protected]";
            pf.sSubject         = "Sample of some PDF features";
            pf.sKeywords        = "Sample PDF RSF";
            pf.sCreator         = "RSF Sample Application";
            pf.dt_CreationDate  = new DateTime(2002, 8, 15, 0, 0, 0, 0);
            pf.pageLayout       = PageLayout.TwoColumnLeft;
            pf.bHideToolBar     = true;
            pf.bHideMenubar     = false;
            pf.bHideWindowUI    = true;
            pf.bFitWindow       = true;
            pf.bCenterWindow    = true;
            pf.bDisplayDocTitle = true;

            RT.ViewPDF(new PdfPropertiesSample(pf), "PdfPropertiesSample.pdf");
        }
示例#7
0
 public void ViewReport()
 {
     RT.ViewPDF(rpt, pdfName);
 }
示例#8
0
        static void Main(String[] asArg)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            Boolean bStartMainForm = true;

            foreach (String s in asArg)
            {
                switch (s)
                {
                case "FlowLayoutManagerSample": {
                    RT.ViewPDF(new FlowLayoutManagerSample(), "FlowLayoutManagerSample.pdf");
                    bStartMainForm = false;
                    break;
                }

                case "Test": {
                    RT.ViewPDF(new Test(), "Test.pdf");
                    bStartMainForm = false;
                    break;
                }

                case "ImageSample": {
                    RT.ViewPDF(new ImageSample(), "ImageSample.pdf");
                    bStartMainForm = false;
                    break;
                }

                case "ListLayoutManagerSample": {
                    RT.ViewPDF(new ListLayoutManagerSample(), "ListLayoutManagerSample.pdf");
                    bStartMainForm = false;
                    break;
                }

                case "PdfPropertiesSample": {
                    RT.ViewPDF(new PdfPropertiesSample(), "PdfPropertiesSample.pdf");
                    bStartMainForm = false;
                    break;
                }

                case "TableLayoutManagerSample": {
                    RT.ViewPDF(new TableLayoutManagerSample(), "TableLayoutManagerSample.pdf");
                    bStartMainForm = false;
                    break;
                }

                case "TextSample": {
                    RT.ViewPDF(new TextSample(), "TextSample.pdf");
                    bStartMainForm = false;
                    break;
                }
                }
            }

            if (bStartMainForm)
            {
                Application.Run(new MainForm());
            }
        }