Exemplo n.º 1
0
        public Stream GenerateSelectedTasksPDF(IEnumerable <SelectedTask> selectedTasks, ReportInfo reportInfo)
        {
            int            countSelectedTasks = selectedTasks.Count();
            int            totalNoiseDosage   = selectedTasks.Sum(x => x.Percentage);
            NoiseLevelEnum noiseLevelEnum     = _noiseLevelService.CalculateNoiseLevelEnum(totalNoiseDosage);
            Color          noiseLevelColor    = GetColorForNoiseLevel(noiseLevelEnum);
            DataTable      dataTable          = GenerateDataTable(selectedTasks);


            // Starting instantiate the document.
            // Remember to set the Docuement Format. In this case, we specify width and height.
            PdfDocument myPdfDocument = new PdfDocument(PdfDocumentFormat.A4_Horizontal);

            // Now we create a Table with lines likt the number of selected tasks, 6 columns and 4 points of Padding.
            PdfTable myPdfTable = myPdfDocument.NewTable(new Font("Verdana", 12), countSelectedTasks, 6, 4);

            // Importing datas from the datatables... (also column names for the headers!)
            myPdfTable.ImportDataTable(dataTable);

            // Now we set our Graphic Design: Colors and Borders...
            myPdfTable.HeadersRow.SetColors(Color.FromRgb(255, 255, 255), Color.FromRgb(0, 0, 255));
            myPdfTable.SetColors(Color.FromRgb(0, 0, 0), Color.FromRgb(255, 255, 255), Color.FromRgb(0, 255, 255));
            myPdfTable.SetBorders(Color.FromRgb(0, 0, 0), 1, BorderType.CompleteGrid);

            // With just one method we can set the proportional width of the columns.
            // It's a "percentage like" assignment, but the sum can be different from 100.
            myPdfTable.SetColumnsWidth(new int[] { 90, 25, 45, 20, 20, 10 });

            // Now we set some alignment... for the whole table and then, for a column.
            myPdfTable.SetContentAlignment(ContentAlignment.MiddleCenter);
            foreach (PdfColumn pdfColumn in myPdfTable.Columns)
            {
                pdfColumn.SetContentAlignment(ContentAlignment.MiddleLeft);
            }

            // Here we start the loop to generate the table...
            while (!myPdfTable.AllTablePagesCreated)
            {
                // we create a new page to put the generation of the new TablePage:
                PdfPage newPdfPage = myPdfDocument.NewPage();

                // LAKHA
                PdfArea      pdfArea   = new PdfArea(myPdfDocument, 48, 95, 750, 670);
                PdfTablePage taskTable = myPdfTable.CreateTablePage(pdfArea);

                // we also put a Label
                PdfTextArea reportTitle = new PdfTextArea(new Font("Verdana", 26, FontStyle.Bold), Color.FromRgb(0, 0, 0)
                                                          , new PdfArea(myPdfDocument, 48, 20, 595, 60), ContentAlignment.TopLeft, ReportResource.ReportTitle);

                // LAKHA - Status
                PdfTextArea statusText = new PdfTextArea(new Font("Verdana", 14, FontStyle.Bold), Color.FromRgb(0, 0, 0)
                                                         , new PdfArea(myPdfDocument, 48, taskTable.CellArea(taskTable.LastRow, 6 - 1).BottomRightCornerY + 10, 595, 60), ContentAlignment.TopLeft,
                                                         _noiseLevelService.GetNoiseLevelStatusText(noiseLevelEnum));

                // LAKHA - Total prosent
                PdfRectangle summaryBackground = new PdfArea(myPdfDocument, 635, taskTable.CellArea(taskTable.LastRow, 6 - 1).BottomRightCornerY + 10, 165, 45).ToRectangle(noiseLevelColor, noiseLevelColor);
                PdfTextArea  summary           = new PdfTextArea(new Font("Verdana", 26, FontStyle.Bold), Color.FromRgb(0, 0, 0)
                                                                 , new PdfArea(myPdfDocument, 640, taskTable.CellArea(taskTable.LastRow, 6 - 1).BottomRightCornerY + 20, 595, 60), ContentAlignment.TopLeft,
                                                                 string.Format(ReportResource.TotalPercentageFormatString, totalNoiseDosage));

                // nice thing: we can put all the objects in the following lines, so we can have
                // a great control of layer sequence...
                newPdfPage.Add(taskTable);
                newPdfPage.Add(reportTitle);
                newPdfPage.Add(statusText);
                newPdfPage.Add(summaryBackground);
                newPdfPage.Add(summary);

                // Info from report input window
                PdfTextArea reportPlant = new PdfTextArea(new Font("Verdana", 12, FontStyle.Bold), Color.FromRgb(0, 0, 0)
                                                          , new PdfArea(myPdfDocument, 48, 50, 595, 60), ContentAlignment.TopLeft, string.Format(ReportResource.PlantFormatString, reportInfo.Plant));
                PdfTextArea reportCreatedBy = new PdfTextArea(new Font("Verdana", 12, FontStyle.Bold), Color.FromRgb(0, 0, 0)
                                                              , new PdfArea(myPdfDocument, 650, 50, 595, 60), ContentAlignment.TopLeft, string.Format(ReportResource.UserFormatString, reportInfo.CreatedBy));

                PdfTextArea reportProfession = new PdfTextArea(new Font("Verdana", 12, FontStyle.Bold), Color.FromRgb(0, 0, 0)
                                                               , new PdfArea(myPdfDocument, 48, 65, 595, 60), ContentAlignment.TopLeft, string.Format(ReportResource.ProfessionFormatString, reportInfo.Group));
                PdfTextArea reportDate = new PdfTextArea(new Font("Verdana", 12, FontStyle.Bold), Color.FromRgb(0, 0, 0)
                                                         , new PdfArea(myPdfDocument, 650, 65, 595, 60), ContentAlignment.TopLeft, string.Format(ReportResource.DateFormatString, (reportInfo.Date.HasValue) ? reportInfo.Date.Value.ToString("dd.MM.yyyy") : string.Empty));

                PdfTextArea reportComment = new PdfTextArea(new Font("Verdana", 12, FontStyle.Bold), Color.FromRgb(0, 0, 0)
                                                            , new PdfArea(myPdfDocument, 48, 80, 700, 60), ContentAlignment.TopLeft, string.Format(ReportResource.CommentFormatString, reportInfo.Comment));

                newPdfPage.Add(reportPlant);
                newPdfPage.Add(reportCreatedBy);
                newPdfPage.Add(reportProfession);
                newPdfPage.Add(reportDate);
                newPdfPage.Add(reportComment);


                // LAKHA - Add footnotes...
                const int widthOfFootnote = 750;
                Font      footnoteFont    = new Font("Verdana", 9, FontStyle.Regular);
                double    posY            = statusText.PdfArea.BottomRightCornerY + 3;

                foreach (string footNoteText in reportInfo.Footnotes)
                {
                    int heightOfFootnote = 10;

                    if (footNoteText.Length > 380)
                    {
                        heightOfFootnote = heightOfFootnote * 3;
                    }
                    else if (footNoteText.Length > 160)
                    {
                        heightOfFootnote = heightOfFootnote * 2;
                    }

                    PdfArea     pdfAreaForText = new PdfArea(myPdfDocument, 48, posY, widthOfFootnote, heightOfFootnote);
                    PdfTextArea footNote       = new PdfTextArea(footnoteFont, Color.FromRgb(0, 0, 0), pdfAreaForText, ContentAlignment.TopLeft, string.Format("* {0}", footNoteText));
                    newPdfPage.Add(footNote);

                    posY = footNote.PdfArea.BottomRightCornerY + 2;
                }

                // we save each generated page before start rendering the next.
                newPdfPage.SaveToDocument();
            }


            // Finally we save the docuement...
            Stream memoryStream = new MemoryStream();

            myPdfDocument.SaveToStream(memoryStream);
            memoryStream.Seek(0, SeekOrigin.Begin);

            return(memoryStream);
        }
    protected void btn_commonprint_OnClick(object sender, EventArgs e)
    {
        try
        {
            string coename  = "";
            string strquery = "select *,district+' - '+pincode  as districtpin from collinfo where college_code='" + Session["collegecode"].ToString() + "'";
            ds.Dispose();
            ds.Reset();
            ds = d2.select_method_wo_parameter(strquery, "Text");
            string Collegename = "";
            string aff         = "";
            string collacr     = "";
            string dispin      = "";
            string category    = "";
            if (ds.Tables[0].Rows.Count > 0)
            {
                Collegename = ds.Tables[0].Rows[0]["Collname"].ToString();
                aff         = ds.Tables[0].Rows[0]["affliatedby"].ToString();
                string[] strpa = aff.Split(',');
                aff      = strpa[0];
                coename  = ds.Tables[0].Rows[0]["coe"].ToString();
                collacr  = ds.Tables[0].Rows[0]["acr"].ToString();
                dispin   = ds.Tables[0].Rows[0]["districtpin"].ToString();
                category = ds.Tables[0].Rows[0]["category"].ToString();
            }
            string degreecode = ddlbranch.SelectedValue.ToString();
            //string
            //string eve = d2.GetFunction(" select c.type from Degree d,Course c where d.Course_Id=c.Course_Id and d.Degree_Code='" + degreecode + "'");
            string eve     = "";
            string course  = "";
            string deptacr = "";

            string headingquery = "select c.type,c.Course_Name,de.dept_name from Degree d,Course c,Department de where d.Course_Id=c.Course_Id and de.Dept_Code=d.Dept_Code and d.Degree_Code='" + degreecode + "'";
            hds = d2.select_method_wo_parameter(headingquery, "Text");
            if (hds.Tables[0].Rows.Count > 0)
            {
                eve     = hds.Tables[0].Rows[0]["type"].ToString();
                course  = hds.Tables[0].Rows[0]["Course_Name"].ToString();
                deptacr = hds.Tables[0].Rows[0]["dept_name"].ToString();
            }
            string batch = ddlbatch.SelectedItem.Text;
            string title = "PAPERS SELECTED BY THE STUDENTS OF " + course + " - " + deptacr + " - BATCH " + batch + " (" + eve + ")";

            Font Fontbold1  = new Font("Times New Roman", 15, FontStyle.Bold);
            Font font2bold  = new Font("Times New Roman", 12, FontStyle.Bold);
            Font font2small = new Font("Times New Roman", 12, FontStyle.Regular);
            Font font3bold  = new Font("Times New Roman", 9, FontStyle.Bold);
            Font font3small = new Font("Times New Roman", 10, FontStyle.Regular);
            Font font4bold  = new Font("Times New Roman", 7, FontStyle.Bold);
            Font font4small = new Font("Times New Roman", 7, FontStyle.Regular);

            Gios.Pdf.PdfDocument  mydoc;
            Gios.Pdf.PdfPage      mypdfpage;
            Gios.Pdf.PdfTable     table1forpage2;
            Gios.Pdf.PdfTablePage newpdftabpage2;

            if (FpSpread2.Sheets[0].RowCount > 0)
            {
                int       nofocolun = 0;
                Hashtable hatrowset = new Hashtable();
                int       haskpage  = 0;
                int       checkrow  = 0;
                for (int r = 0; r < FpSpread2.Sheets[0].RowCount; r++)
                {
                    string nameval = FpSpread2.Sheets[0].Cells[r, 1].Text.ToString();
                    if (nameval.Trim() != "")
                    {
                        checkrow++;
                        if (checkrow == 11 || checkrow == 1)
                        {
                            haskpage++;
                            checkrow = 1;
                        }
                    }
                    if (hatrowset.Contains(haskpage))
                    {
                        hatrowset[haskpage] = Convert.ToInt32(hatrowset[haskpage]) + 1;
                    }
                    else
                    {
                        hatrowset.Add(haskpage, 1);
                    }
                }
                int pagcount = hatrowset.Count;
                haskpage = 0;
                int totcol     = FpSpread2.Sheets[0].ColumnCount - 3;
                int noofcolumn = totcol / 10;
                if (((FpSpread2.Sheets[0].ColumnCount - 3) % 10) > 0)
                {
                    noofcolumn++;
                }
                mydoc = new Gios.Pdf.PdfDocument(PdfDocumentFormat.InCentimeters(60, 40));
                int startcolun = 0;
                int endcolumn;
                int stratrow = 0;
                int endrow   = 0;
                for (int pc = 1; pc <= pagcount; pc++)
                {
                    int noofrows = Convert.ToInt32(hatrowset[pc]);
                    startcolun = 3;
                    stratrow   = endrow;
                    endrow     = stratrow + noofrows;
                    startcolun = 3;
                    int colcou = 3;
                    for (int col = 0; col < noofcolumn; col++)
                    {
                        if (col > 0)
                        {
                            startcolun = startcolun + 10;
                        }
                        endcolumn = startcolun + 10;
                        if (endcolumn > FpSpread2.Sheets[0].ColumnCount)
                        {
                            endcolumn = FpSpread2.Sheets[0].ColumnCount;
                        }
                        colcou    = colcou + 10;
                        nofocolun = 13;
                        if (colcou > FpSpread2.Sheets[0].ColumnCount)
                        {
                            colcou    = (FpSpread2.Sheets[0].ColumnCount + 10) - colcou;
                            nofocolun = colcou + 3;
                        }

                        mypdfpage = mydoc.NewPage();
                        int coltop = 20;

                        #region Left Logo

                        if (File.Exists(HttpContext.Current.Server.MapPath("~/college/Left_Logo.jpeg")))
                        {
                            PdfImage LogoImage = mydoc.NewImage(HttpContext.Current.Server.MapPath("~/college/Left_Logo.jpeg"));
                            mypdfpage.Add(LogoImage, 35, 20, 320);
                        }

                        #endregion

                        #region TOP DETAILS

                        coltop = coltop + 10;

                        PdfTextArea ptc = new PdfTextArea(Fontbold1, System.Drawing.Color.Black,
                                                          new PdfArea(mydoc, 0, coltop, 1700, 30), System.Drawing.ContentAlignment.TopCenter, Collegename + "(" + category + ")");
                        mypdfpage.Add(ptc);

                        coltop = coltop + 20;

                        ptc = new PdfTextArea(Fontbold1, System.Drawing.Color.Black,
                                              new PdfArea(mydoc, 0, coltop, 1700, 30), System.Drawing.ContentAlignment.TopCenter, title);
                        mypdfpage.Add(ptc);

                        coltop = coltop + 20;

                        //ptc = new PdfTextArea(font2bold, System.Drawing.Color.Black,
                        //                                            new PdfArea(mydoc, 560, coltop, 595, 30), System.Drawing.ContentAlignment.TopCenter, aff);
                        //mypdfpage.Add(ptc);
                        //coltop = coltop + 15;

                        //ptc = new PdfTextArea(font2bold, System.Drawing.Color.Black,
                        //                                            new PdfArea(mydoc, 560, coltop, 595, 30), System.Drawing.ContentAlignment.TopCenter, dispin);
                        //mypdfpage.Add(ptc);

                        #endregion

                        # region Table Binding

                        table1forpage2 = mydoc.NewTable(font3small, noofrows + 1, nofocolun, 4);
                        table1forpage2.VisibleHeaders = false;
                        table1forpage2.SetBorders(Color.Black, 1, BorderType.CompleteGrid);
                        table1forpage2.Cell(0, 0).SetContentAlignment(ContentAlignment.MiddleCenter);
                        table1forpage2.Cell(0, 0).SetContent("S.No");
                        table1forpage2.Columns[0].SetWidth(30);
                        table1forpage2.Cell(0, 1).SetContentAlignment(ContentAlignment.MiddleCenter);
                        table1forpage2.Cell(0, 1).SetContent("Reg.No");
                        table1forpage2.Columns[1].SetWidth(60);
                        table1forpage2.Cell(0, 2).SetContentAlignment(ContentAlignment.MiddleCenter);
                        table1forpage2.Cell(0, 2).SetContent("Student Name");
                        table1forpage2.Columns[2].SetWidth(150);
                        //table1forpage2.Cell(0, 3).SetContentAlignment(ContentAlignment.MiddleCenter);
                        //table1forpage2.Cell(0, 3).SetContent("(Total Papers Selected)");
                        //table1forpage2.Columns[3].SetWidth(80);
                        //table1forpage2.Cell(0, 4).SetContentAlignment(ContentAlignment.MiddleCenter);
                        //table1forpage2.Cell(0, 4).SetContent("Total Papers Appeared");
                        //table1forpage2.Columns[4].SetWidth(80);

                        table1forpage2.Cell(0, 0).SetFont(font2bold);
                        table1forpage2.Cell(0, 1).SetFont(font2bold);
                        table1forpage2.Cell(0, 2).SetFont(font2bold);
                        //table1forpage2.Cell(0, 3).SetFont(font2bold);
                        //table1forpage2.Cell(0, 4).SetFont(font2bold);

                        int totalrow = endrow - stratrow;
                        int tr       = 0;
                        int tc       = 3;
                        for (int r = stratrow; r < endrow; r++)
                        {
                            tr++;
                            tc = 2;
                            table1forpage2.Cell(tr, 0).SetContentAlignment(ContentAlignment.MiddleCenter);
                            table1forpage2.Cell(tr, 1).SetContentAlignment(ContentAlignment.MiddleLeft);
                            table1forpage2.Cell(tr, 2).SetContentAlignment(ContentAlignment.MiddleLeft);
                            //table1forpage2.Cell(tr, 3).SetContentAlignment(ContentAlignment.MiddleCenter);
                            //table1forpage2.Cell(tr, 4).SetContentAlignment(ContentAlignment.MiddleCenter);
                            table1forpage2.Cell(tr, 0).SetContent(FpSpread2.Sheets[0].Cells[r, 0].Text.ToString());
                            table1forpage2.Cell(tr, 1).SetContent(FpSpread2.Sheets[0].Cells[r, 1].Text.ToString());
                            table1forpage2.Cell(tr, 1).SetFont(font2bold);
                            table1forpage2.Cell(tr, 2).SetContent(FpSpread2.Sheets[0].Cells[r, 2].Text.ToString());
                            table1forpage2.Cell(tr, 2).SetFont(font2bold);
                            //table1forpage2.Cell(tr, 3).SetContent(FpSpread2.Sheets[0].Cells[r, 3].Text.ToString());
                            //table1forpage2.Cell(tr, 3).SetFont(font3small);
                            //table1forpage2.Cell(tr, 4).SetContent(FpSpread2.Sheets[0].Cells[r, 4].Text.ToString());
                            //table1forpage2.Cell(tr, 4).SetFont(font3small);
                            for (int c = startcolun; c < endcolumn; c++)
                            {
                                tc++;
                                if (tc < FpSpread2.Sheets[0].ColumnCount)
                                {
                                    if (r == stratrow)
                                    {
                                        table1forpage2.Cell(0, tc).SetContentAlignment(ContentAlignment.MiddleCenter);
                                        table1forpage2.Cell(0, tc).SetContent(FpSpread2.Sheets[0].ColumnHeader.Cells[0, c].Text.ToString());
                                        table1forpage2.Cell(0, tc).SetFont(font2bold);
                                        table1forpage2.Columns[tc].SetWidth(100);
                                        table1forpage2.Cell(tr, tc).SetCellPadding(20);
                                    }
                                    table1forpage2.Cell(tr, tc).SetContent(FpSpread2.Sheets[0].Cells[r, c].Text.ToString());
                                    table1forpage2.Cell(tr, tc).SetFont(font2bold);
                                    string value = FpSpread2.Sheets[0].Cells[r, c].Text.ToString().ToString();
                                    if (value.Trim() == "")
                                    {
                                        table1forpage2.Cell(tr, tc).SetContent(".");
                                        table1forpage2.Cell(tr, tc).SetForegroundColor(Color.White);
                                    }
                                    if (totalrow > 40)
                                    {
                                        table1forpage2.Cell(tr, tc).SetCellPadding(1);
                                    }
                                    else if (totalrow > 30)
                                    {
                                        table1forpage2.Cell(tr, tc).SetCellPadding(5);
                                    }
                                    else if (totalrow > 18)
                                    {
                                        table1forpage2.Cell(tr, tc).SetCellPadding(10);
                                    }
                                    else
                                    {
                                        table1forpage2.Cell(tr, tc).SetCellPadding(20);
                                    }
                                }
                            }
                        }
                        newpdftabpage2 = table1forpage2.CreateTablePage(new Gios.Pdf.PdfArea(mydoc, 15, 130, 1670, 5000));
                        mypdfpage.Add(newpdftabpage2);
                        mypdfpage.SaveToDocument();

                        #endregion
                    }
                }

                string appPath = HttpContext.Current.Server.MapPath("~");
                if (appPath != "")
                {
                    string szPath = appPath + "/Report/";
                    string szFile = "SubjectAllotment" + DateTime.Now.ToString("ddMMyyyy") + DateTime.Now.ToString("HHMMss") + ".pdf";
                    mydoc.SaveToFile(szPath + szFile);
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + szFile);
                    Response.ContentType = "application/pdf";
                    Response.WriteFile(szPath + szFile);
                }
            }
        }
    protected void btndummynoprint_Click(object sender, EventArgs e)
    {
        try
        {
            ArrayList            adddummyarray = new ArrayList();
            Gios.Pdf.PdfDocument mydoc;
            Font Fontbold    = new Font("Book Antiqua", 18, FontStyle.Regular);
            Font fbold       = new Font("Book Antiqua", 18, FontStyle.Bold);
            Font Fontsmall   = new Font("Book Antiqua", 12, FontStyle.Regular);
            Font fontname    = new Font("Book Antiqua", 11, FontStyle.Bold);
            Font fontmedium  = new Font("Book Antiqua", 10, FontStyle.Regular);
            Font fontmediumb = new Font("Book Antiqua", 8, FontStyle.Bold);
            mydoc = new Gios.Pdf.PdfDocument(PdfDocumentFormat.InCentimeters(24, 30));
            Gios.Pdf.PdfPage mypdfpage;
            //  Gios.Pdf.PdfTable table1 = myprovdoc.NewTable(Fontsmall, prov_cnt + 8, 6, 1);
            Gios.Pdf.PdfTable     table;
            Gios.Pdf.PdfTable     table1;
            Gios.Pdf.PdfTablePage myprov_pdfpage1;
            string deptvalue = "";
            Fpspread1.SaveChanges();

            int    prinsheetno   = 0;
            string getmaxsheetno = d2.GetFunction("select isnull(max(sheet_no),'10000') from dummynumber where exam_year='" + ddlYear.SelectedValue.ToString() + "' and exam_month='" + ddlMonth.SelectedValue.ToString() + "' ");
            int    strshetno     = Convert.ToInt32(getmaxsheetno);
            if (Fpspread1.Sheets[0].RowCount > 0)
            {
                for (int row = 0; row < Fpspread1.Sheets[0].RowCount; row++)
                {
                    string getval = Fpspread1.Sheets[0].Cells[row, 2].Tag.ToString();
                    if (getval == "1")
                    {
                        adddummyarray.Add(Convert.ToString(Fpspread1.Sheets[0].Cells[row, 2].Text));
                    }
                    else
                    {
                        adddummyarray.Add(Convert.ToString(Fpspread1.Sheets[0].Cells[row, 3].Text));
                    }
                    string dummyno = Fpspread1.Sheets[0].Cells[row, 3].Tag.ToString();
                    if (dummyno == "")
                    {
                        if ((row % 25) == 0)
                        {
                            strshetno++;
                        }
                        dummyno = strshetno.ToString();
                        string insertval = "update dummynumber set sheet_no='" + dummyno + "' where dummy_no='" + Fpspread1.Sheets[0].Cells[row, 3].Text.ToString() + "'";
                        int    val       = d2.update_method_wo_parameter(insertval, "Text");
                    }
                    if (prinsheetno == 0)
                    {
                        prinsheetno = Convert.ToInt32(dummyno);
                    }
                    Fpspread1.Sheets[0].Cells[row, 3].Tag = dummyno;
                }
            }
            Fpspread1.SaveChanges();
            string month = Convert.ToString(ddlMonth.SelectedItem.Text);
            string year  = Convert.ToString(ddlYear.SelectedItem.Text);
            string dept  = "";
            if (chklstbranch.Items.Count > 0)
            {
                for (int ros = 0; ros < chklstbranch.Items.Count; ros++)
                {
                    if (chklstbranch.Items[ros].Selected == true)
                    {
                        dept = Convert.ToString(chklstbranch.Items[ros].Text);
                    }
                }
            }
            string course = Convert.ToString(Fpspread1.Sheets[0].Cells[0, 4].Text);
            deptvalue = Convert.ToString(Fpspread1.Sheets[0].Cells[0, 5].Text);
            string semval      = Convert.ToString(Fpspread1.Sheets[0].Cells[0, 4].Tag);
            string subjectname = ddlsubject.SelectedItem.Text;
            string subjectcode = ddlsubject.SelectedItem.Value;


            PdfTextArea ptc4 = new PdfTextArea(Fontsmall, System.Drawing.Color.Black,
                                               new PdfArea(mydoc, 515, 0, 113, 30), System.Drawing.ContentAlignment.MiddleCenter, prinsheetno.ToString());

            PdfTextArea ptc5 = new PdfTextArea(Fontsmall, System.Drawing.Color.Black,
                                               new PdfArea(mydoc, 515, 30, 113, 20), System.Drawing.ContentAlignment.MiddleCenter, month + " " + year);

            int y = 48;

            PdfTextArea ptde = new PdfTextArea(fontmedium, System.Drawing.Color.Black,
                                               new PdfArea(mydoc, 120, y, 100, 30), System.Drawing.ContentAlignment.MiddleLeft, "" + course + "");

            PdfTextArea ptc = new PdfTextArea(fontmedium, System.Drawing.Color.Black,
                                              new PdfArea(mydoc, 303, y, 350, 30), System.Drawing.ContentAlignment.MiddleLeft, "" + deptvalue + "");

            PdfTextArea psem = new PdfTextArea(fontmedium, System.Drawing.Color.Black,
                                               new PdfArea(mydoc, 544, y, 200, 30), System.Drawing.ContentAlignment.MiddleLeft, "" + semval + "");

            y = y + 20;
            PdfTextArea ptc1 = new PdfTextArea(fontmedium, System.Drawing.Color.Black,
                                               new PdfArea(mydoc, 120, y, 350, 30), System.Drawing.ContentAlignment.MiddleLeft, "" + subjectname + "");

            PdfTextArea ptc2 = new PdfTextArea(fontmedium, System.Drawing.Color.Black,
                                               new PdfArea(mydoc, 544, y, 200, 30), System.Drawing.ContentAlignment.MiddleLeft, "" + subjectcode + "");
            if (adddummyarray.Count > 0)
            {
                int rowcount   = 0;
                int totalcount = adddummyarray.Count;
                while (totalcount > 25)
                {
                    if (rowcount > 24)
                    {
                        prinsheetno++;
                        ptc4 = new PdfTextArea(Fontsmall, System.Drawing.Color.Black,
                                               new PdfArea(mydoc, 515, 2, 113, 30), System.Drawing.ContentAlignment.MiddleCenter, prinsheetno.ToString());
                    }
                    totalcount = totalcount - 25;
                    table      = mydoc.NewTable(Fontsmall, 13, 1, 10);
                    for (int row = 0; row < 13; row++)
                    {
                        string getvalue = Convert.ToString(adddummyarray[rowcount]);
                        table.Cell(row, 0).SetContent(getvalue);
                        table.Cell(row, 0).SetContentAlignment(ContentAlignment.MiddleLeft);
                        table.Cell(row, 0).SetCellPadding(11);
                        rowcount++;
                    }
                    table1 = mydoc.NewTable(Fontsmall, 12, 1, 10);
                    for (int row = 0; row < 12; row++)
                    {
                        string getvalue = Convert.ToString(adddummyarray[rowcount]);
                        table1.Cell(row, 0).SetContent(getvalue);
                        table1.Cell(row, 0).SetCellPadding(11);
                        rowcount++;
                    }
                    mypdfpage       = mydoc.NewPage();
                    myprov_pdfpage1 = table.CreateTablePage(new Gios.Pdf.PdfArea(mydoc, 50, 150, 100, 500));
                    mypdfpage.Add(myprov_pdfpage1);

                    myprov_pdfpage1 = table1.CreateTablePage(new Gios.Pdf.PdfArea(mydoc, 340, 150, 100, 500));
                    mypdfpage.Add(myprov_pdfpage1);
                    mypdfpage.Add(ptc);
                    mypdfpage.Add(ptc1);
                    mypdfpage.Add(ptc2);
                    mypdfpage.Add(ptc4);
                    mypdfpage.Add(ptc5);
                    mypdfpage.Add(ptde);
                    mypdfpage.Add(psem);
                    mypdfpage.SaveToDocument();
                }
                bool check         = false;
                int  subtotalcount = totalcount;
                int  value         = 0;
                mypdfpage = mydoc.NewPage();
                if (subtotalcount >= 13)
                {
                    value = subtotalcount - 13;
                    check = true;
                }
                if (check == true)
                {
                    prinsheetno++;
                    ptc4 = new PdfTextArea(Fontsmall, System.Drawing.Color.Black,
                                           new PdfArea(mydoc, 515, 2, 113, 30), System.Drawing.ContentAlignment.MiddleCenter, prinsheetno.ToString());

                    table = mydoc.NewTable(Fontsmall, 13, 1, 10);
                    for (int row = 0; row < 13; row++)
                    {
                        string getvalue = Convert.ToString(adddummyarray[rowcount]);
                        table.Cell(row, 0).SetContent(getvalue);
                        rowcount++;
                    }
                    myprov_pdfpage1 = table.CreateTablePage(new Gios.Pdf.PdfArea(mydoc, 50, 150, 100, 500));
                    mypdfpage.Add(myprov_pdfpage1);
                }
                else
                {
                    prinsheetno++;
                    ptc4 = new PdfTextArea(Fontsmall, System.Drawing.Color.Black,
                                           new PdfArea(mydoc, 515, 2, 113, 30), System.Drawing.ContentAlignment.MiddleCenter, prinsheetno.ToString());
                    table = mydoc.NewTable(Fontsmall, subtotalcount, 1, 10);
                    for (int row = 0; row < subtotalcount; row++)
                    {
                        string getvalue = Convert.ToString(adddummyarray[rowcount]);
                        table.Cell(row, 0).SetContent(getvalue);
                        rowcount++;
                    }
                    myprov_pdfpage1 = table.CreateTablePage(new Gios.Pdf.PdfArea(mydoc, 50, 150, 100, 500));
                    mypdfpage.Add(myprov_pdfpage1);
                }
                if (value != 0)
                {
                    table1 = mydoc.NewTable(Fontsmall, value, 1, 10);
                    for (int row = 0; row < value; row++)
                    {
                        string getvalue = Convert.ToString(adddummyarray[rowcount]);
                        table1.Cell(row, 0).SetContent(getvalue);
                        rowcount++;
                    }
                    myprov_pdfpage1 = table1.CreateTablePage(new Gios.Pdf.PdfArea(mydoc, 340, 170, 100, 500));
                    mypdfpage.Add(myprov_pdfpage1);
                }
                mypdfpage.Add(ptc);
                mypdfpage.Add(ptc1);
                mypdfpage.Add(ptc2);
                mypdfpage.Add(ptc4);
                mypdfpage.Add(ptc5);
                mypdfpage.Add(ptde);
                mypdfpage.Add(psem);
                mypdfpage.SaveToDocument();
                string appPath = HttpContext.Current.Server.MapPath("~");
                if (appPath != "")
                {
                    string szPath = appPath + "/Report/";
                    string szFile = "Dummy.pdf";
                    mydoc.SaveToFile(szPath + szFile);
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + szFile);
                    Response.ContentType = "application/pdf";
                    Response.WriteFile(szPath + szFile);
                }
            }
        }
        catch
        {
        }
    }