public IActionResult DownloadPDFFile(string pageName)
        {
            var pdf = new GeneratePdf($"https://{Request.Host.Value}/{pageName}");

            var pdfFile   = pdf.GetPdf();
            var pdfStream = new System.IO.MemoryStream(pdfFile);

            return(new FileStreamResult(pdfStream, "application/pdf"));
        }
Example #2
0
        private Task GeneratePdf(GeneratePdf pdf)
        {
            try
            {
                var response = _generateFile.Create(pdf.DocumetInfo);

                var receivedMessage = $"Received message {pdf}";
                Console.WriteLine(receivedMessage);
                Sender?.SendSimpleMessage(receivedMessage);
                Sender?.SendSimpleMessage($"My Current working DIR = {Environment.CurrentDirectory}");

                if (Sender == null)
                {
                    throw new PdfWorkerError(PdfGenerationError.NoSenderIdentified, pdf);
                }

                if (response.IsSuccess)
                {
                    Sender?.Tell(new SuccessGeneratePdf
                    {
                        //FileName = TODO
                    });
                }
                else
                {
                    Sender?.Tell(new ErrorGeneratePdf
                    {
                        Code    = PdfGenerationError.Unknown, //TODO
                        Message = response.Message
                    });
                }
            }
            catch (PdfWorkerError pdfWorkerError)
            {
                Sender?.Tell(new ErrorGeneratePdf
                {
                    Message = pdfWorkerError.Message,
                    Code    = pdfWorkerError.Code
                });
            }
            catch (System.Exception e)
            {
                Sender?.Tell(new ErrorGeneratePdf
                {
                    Code    = PdfGenerationError.Unknown,
                    Message = e.Message
                });
            }

            Sender?.SendSimpleMessage("Actor finished");

            return(Task.CompletedTask);
        }
Example #3
0
        public void Setup()
        {
            _dateTimeProvider = A.Fake <IDateTimeProvider>();
            _questionAnswerViewModelBuilder = A.Fake <IQuestionAnswerViewModelBuilder>();
            _queryDispatcher = A.Fake <IQueryDispatcher>();
            _pdfHelper       = A.Fake <IPdfHelper>();
            _clinicalSystemIdDescriptionProvider = A.Fake <IClinicalSystemIdDescriptionProvider>();

            A.CallTo(() => _clinicalSystemIdDescriptionProvider.GetDescription()).Returns(ClinicalSystemId);

            _pdfGenerator = new GeneratePdf(_dateTimeProvider, _questionAnswerViewModelBuilder, _queryDispatcher, _pdfHelper, _clinicalSystemIdDescriptionProvider);
        }
Example #4
0
        public async Task <HttpResponseMessage> getstatementspdf([FromBody] GeneratePdf generatePdf)
        {
            // To do - Move the following code to a single method & use it across the project
            IEnumerable <string> tokenValues;
            string tokenValue = "";

            if (Request.Headers.TryGetValues("AuthorizationToken", out tokenValues))
            {
                tokenValue = tokenValues.FirstOrDefault();
            }
            var payment = await loanService.GetgetstatementspdfAsync(tokenValue, generatePdf);

            return(payment);
        }
Example #5
0
        public ActionResult Index()
        {
            var pdf    = new GeneratePdf();
            var newPdf = pdf.TestPdf();

            Response.Clear();
            Response.ContentType = "application/pdf"; string pdfName = "User";
            Response.AddHeader("Content-Disposition", "attachment; filename=" + pdfName + ".pdf");
            Response.ContentType = "application/pdf";
            Response.Buffer      = true;
            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            Response.BinaryWrite(newPdf);
            Response.End();
            Response.Close();
            return(View());
        }
Example #6
0
        public byte[] generatePdf(string caseid, string url)
        {
            byte[] pdfData = null;

            try
            {
                //log start time generating pdf to db
                /*exceptionlog exLg = new exceptionlog();
                exLg.message = "starting time generating pdf before web service call = 0";
                exLg.source = caseid;
                exLg.stacktrace = DateTime.Now.ToString();
                exLg.targetsitename = "";
                dao.logException(exLg);
                Stopwatch stpwatch = Stopwatch.StartNew();*/

                //populate pdf byte array
                GeneratePdf genPdf = new GeneratePdf();
                MemoryStream output = genPdf.createPdf(caseid, url);
                pdfData = output.ToArray();

                //log end time generating pdf to db
                /*exLg = new exceptionlog();
                exLg.message = "ending time generating pdf before web service call = "+stpwatch.ElapsedMilliseconds;
                exLg.source = caseid;
                exLg.stacktrace = DateTime.Now.ToString();
                exLg.targetsitename = "";
                dao.logException(exLg);*/
            }
            catch (Exception excp)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = excp.Message + " class: ActivityStatus Method: generatePdf Getting pdf byte array. activity id=" + caseid;
                exLog.source = excp.Source;

                string strtmp = excp.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = excp.TargetSite.Name;

                dao.logException(exLog);
            }

            return pdfData;
        }
        protected void createMzaPdf(object sender, EventArgs e)
        {
            string caseId = "";
            if (ViewState["caseid"] != null)
            {
                caseId = ViewState["caseid"].ToString();
            }

            sendPdf = true;
            submitMza(null, null);

            //test pdf
            string url = Server.MapPath("~/_layouts/Zurich/Printpages/");
            GeneratePdf genPdf = new GeneratePdf();
            MemoryStream output = genPdf.createPdf(caseId, url);
            pdfData = output.ToArray();

            if (pdfData != null && pdfData.Length > 0)
            {
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", string.Format("attachment;filename=ZPlan.pdf"));
                Response.BinaryWrite(pdfData);
            }
        }
Example #8
0
        public HttpResponseMessage ExportMakerSheet(Int64 id)
        {
            // Get datas
            var orderData            = _order.GetInfo(id);
            var productData          = _makerSheet.GetAllProducts(id);
            var productComponentData = _makerSheet.GetAllProductComponents(id);
            var componentData        = _makerSheet.GetAllComponents(id);

            //update Product step to in-process: 2
            _orderProduct.UpdateProductStep(id, 2, RequestContext.Principal.Identity.Name);

            var productDistinct = productData.GroupBy(test => test.ProductName)
                                  .Select(grp => grp.First())
                                  .ToList();

            GeneratePdf pdf = new GeneratePdf();
            Dictionary <string, string> columns       = new Dictionary <string, string>();
            Dictionary <string, string> detailColumns = new Dictionary <string, string>();
            string caution     = string.Empty;
            string bodyContent = string.Empty;
            string generalInfo = @"<table style='font-size: 9pt;'>
                                    <tr><td>SALE ID:</td><td>{0}</td></tr>
                                    <tr><td>CUSTOMER:</td><td>{1}</td></tr>
                                    <tr><td>NAME/REF:</td><td>{2}</td></tr>
                                    <tr><td>SITE ADDRESS:</td><td>{3}</td></tr>
                                    <tr><td>SALE DATE:</td><td>{4}</td></tr>
                                    <tr><td>REQ DATE:</td><td>{5}</td></tr>
                                    </table>";

            bodyContent += string.Format(generalInfo,
                                         orderData.Id,
                                         orderData.CustomerName,
                                         orderData.OrderRefNo,
                                         orderData.CustomerAddress,
                                         orderData.OrderDate,
                                         orderData.PickupDateForOrderOnly);

            int totalPage = productDistinct.Count();

            for (int i = 0; i < totalPage; i++)
            {
                MakerSheet pro = productDistinct[i];
                switch (pro.CategoryCode)
                {
                case "ROLLERBLIND":
                    columns = new Dictionary <string, string>
                    {
                        { "LocationName", "LOC" },
                        { "Width", "WIDTH" },
                        { "Drop", "DROP" },
                        { "Quantity", "QTY" },
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "ControlSideId", "CTRL" },
                        { "ControlHBOL", "CTRL HEIGHT" },
                        { "ControlColorName", "CTRL COL" },
                        { "BKTId", "BKT" },
                    };
                    detailColumns = new Dictionary <string, string>
                    {
                        { "MaterialColorName", "M. COL" },
                        { "MaterialWidth", "M WIDTH" },
                        { "MaterialDrop", "M DROP" },
                        { "Quantity", "QTY" },
                        { "TubeWidth", "TUBE WITH" },
                        { "BarColorName", "BAR COL" },
                        { "RollId", "ROLL" },
                        { "Notes", "NOTE" },
                    };
                    break;

                case "ZIPSCREEN":

                    columns = new Dictionary <string, string>
                    {
                        { "LocationName", "LOC" },
                        { "Width", "WIDTH" },
                        { "Drop", "DROP" },
                        { "Quantity", "QTY" },
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "ControlSideId", "CTRL" },
                        { "Notes", "NOTE" },
                    };
                    detailColumns = new Dictionary <string, string>
                    {
                        { "MaterialWidth", "M WIDTH" },
                        { "MaterialDrop", "M DROP" },
                        { "Quantity", "QTY" },
                        { "TSplineName", "B. SPLINE" },
                        { "TubeDia", "TUBE DIA" },
                        { "TubeWidth", "TUBE WIDTH" },
                        { "BarColorName", "BAR COL" },
                        { "BAR WIDTH", "BAR WIDTH" },
                        { "BoxColorName", "BOX COL" },
                        { "BOX WIDTH", "BOX WIDTH" },
                        { "GuideColorName", "GUIDE COL" },
                        { "OuterTrackDrop", "OUTER GUIDE" },
                        { "InnerTrackDrop", "INNER GUIDE" },
                        //{"Notes", "NOTE"}
                    };
                    caution = "SIDE OF MATERIAL = NO ZIP (ON 200MM TOP AND 20MM BOTTOM)";
                    break;

                case "FLYSCREEN":
                    columns = new Dictionary <string, string>
                    {
                        { "LocationName", "LOC" },
                        { "Width", "WIDTH" },
                        { "Drop", "DROP" },
                        { "Quantity", "QTY" },
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "ControlSideId", "SPRING" },
                        { "RollId", "TAB" },
                    };
                    detailColumns = new Dictionary <string, string>
                    {
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "FrameWidth", "FRAME WIDTH" },
                        { "FrameDrop", "FRAME DROP" },
                        { "Quantity", "QTY" },
                        { "Notes", "NOTE" },
                    };
                    break;

                case "SECURITY":
                    columns = new Dictionary <string, string>
                    {
                        { "LocationName", "LOC" },
                        { "Width", "WIDTH" },
                        { "Drop", "DROP" },
                        { "Quantity", "QTY" },
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "ControlColorName", "CTRL" },
                        { "ControlHBOL", "BOL" },
                    };
                    detailColumns = new Dictionary <string, string>
                    {
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "FrameWidth", "FRAME WIDTH" },
                        { "FrameDrop", "FRAME DROP" },
                        { "Quantity", "QTY" },
                        { "MeshWidth", "MESH WIDTH" },
                        { "MeshDrop", "MESH DROP" }
                    };
                    break;

                case "FLYDOOR":
                    columns = new Dictionary <string, string>
                    {
                        { "LocationName", "LOC" },
                        { "Width", "WIDTH" },
                        { "Drop", "DROP" },
                        { "Quantity", "QTY" },
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "ControlColorName", "CTRL" },
                        { "ControlHBOL", "BOL" },
                    };
                    detailColumns = new Dictionary <string, string>
                    {
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "FrameWidth", "FRAME WIDTH" },
                        { "FrameDrop", "FRAME DROP" },
                        { "Quantity", "QTY" },
                        { "MeshWidth", "MESH WIDTH" },
                        { "MeshDrop", "MESH DROP" },
                        { "Notes", "NOTE" },
                    };
                    break;

                case "RS":
                    columns = new Dictionary <string, string>
                    {
                        { "LocationName", "LOC" },
                        { "Width", "WIDTH" },
                        { "Drop", "DROP" },
                        { "Quantity", "QTY" },
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "ControlColorName", "CTRL" },
                        { "Notes", "NOTE" },
                    };
                    detailColumns = new Dictionary <string, string>
                    {
                        { "MaterialColorName", "M. COL" },
                        { "Quantity", "QTY" },
                        { "BarColorName", "BAR COL" },
                        { "RollId", "ROLL" },
                        { "BoxTypeDrop", "Box Type" },
                        { "BoxLength", "Box Length" },
                        { "BottomBarHeight", "BottomBar Height" },
                        { "BottomBarLength", "BottomBar Length" },
                        { "SlatHeight", "Slat Height" },
                        { "SlatAmount", "Slat Amount" },
                        { "SlatLenght", "Slat Length" },
                        { "AxleLenght", "Axle Length" },
                    };
                    break;

                default:
                    columns = new Dictionary <string, string>
                    {
                        { "LocationName", "LOC" },
                        { "Width", "WIDTH" },
                        { "Drop", "DROP" },
                        { "Quantity", "QTY" },
                        { "MaterialName", "MATERIAL" },
                        { "MaterialColorName", "COL" },
                        { "ControlColorName", "CTRL" }
                    };
                    detailColumns = new Dictionary <string, string>
                    {
                        { "MaterialColorName", "COL" },
                        { "MaterialWidth", "M WIDTH" },
                        { "MaterialDrop", "M DROP" },
                        { "Quantity", "QTY" },
                        { "TSpline", "T. SPLINE" },
                        { "BSpline", "B. SPLINE" },
                        { "Flap", "FLAP" },
                        { "TubeDia", "TUBE DIA" },
                        { "TubeWidth", "TUBE WIDTH" },
                        { "BarColorName", "BAR COL" },
                        { "BarWidth", "BAR WIDTH" },
                        { "BoxColorName", "BOX COL" },
                        { "BoxWidth", "BOX WIDTH" }
                    };
                    break;
                }

                // Title
                bodyContent += pdf.FormatTitle(string.Format("{0} ({1} of {2} in order)", pro.ProductName, i + 1, totalPage));
                var products = productData.Where(p => p.ProductName == pro.ProductName).ToList();
                bodyContent += pdf.ToDataTable <MakerSheet>(products, columns, "Id");

                // Title detail
                bodyContent += pdf.FormatTitle("MAKING DETAIL");
                bodyContent += pdf.FormatTitle(caution, "p");
                bodyContent += pdf.ToDataTable <MakerSheet>(products, detailColumns, "Id");

                // Product Components
                bodyContent += pdf.FormatTitle("Product Components");
                var productComponents = productComponentData.Where(p => p.ProductId == pro.ProductId)
                                        .GroupBy(item => item.ComponentCode)
                                        .Select(cl => new MakerSheetComponent()
                {
                    ProductId     = cl.First().ProductId,
                    ComponentName = cl.First().ComponentName,
                    ComponentCode = cl.First().ComponentCode,
                    Quantity      = cl.Sum(s => s.Quantity),
                    ColorName     = cl.First().ColorName,
                    Size          = cl.First().Size
                })
                                        .ToList();
                columns = new Dictionary <string, string>
                {
                    { "ComponentName", "NAME" },
                    { "Quantity", "QTY" },
                    { "ColorName", "COLOUR" },
                    { "Size", "SIZE" }
                };
                bodyContent += pdf.ToDataTable <MakerSheetComponent>(productComponents, columns);

                if (pro.CategoryCode == "SECURITY")
                {
                    foreach (var product in products)
                    {
                        string image = @"<br/>
                                        {3}
                                        <table>
                                            <tr>
                                                <td width='100px' height='150px' style='border: 1px solid #ccc;text-align:center; vertical-align: middle;'>
                                                    Frame
                                                </td>
                                                <td style='transform: rotate(270deg);'>
                                                    <span>{0}</span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style='text-align:center;'>
                                                    <span>{1}</span>
                                                </td>
                                                <td></td>
                                            </tr>
                                        </table> 
                                        <div>Note:{2}</div>
                                        ";
                        bodyContent += string.Format(image, product.Drop, product.Width, product.Notes, product.MaterialName);
                    }
                }
                // Break to new page
                if (i + 1 < totalPage)
                {
                    bodyContent += pdf.NewPage;
                }
            }

            // Components
            var components = componentData.GroupBy(item => new { item.ComponentCode, item.Size })
                             .Select(cl => new MakerSheetComponent()
            {
                ProductId     = cl.First().ProductId,
                ComponentName = cl.First().ComponentName,
                ComponentCode = cl.First().ComponentCode,
                Quantity      = cl.Sum(s => s.Quantity),
                ColorName     = cl.First().ColorName,
                Size          = cl.First().Size
            }).ToList();

            if (components.Count() > 0)
            {
                // Break to new page
                bodyContent += pdf.NewPage;
                bodyContent += pdf.FormatTitle("OTHER ITEMS");
                columns      = new Dictionary <string, string>
                {
                    { "ComponentName", "NAME" },
                    { "Quantity", "QTY" },
                    { "ColorName", "COLOUR" },
                    { "Size", "SIZE" }
                };
                bodyContent += pdf.ToDataTable <MakerSheetComponent>(components, columns);
            }

            string html = pdf.HtmlBody(bodyContent);

            string fileName = string.Format("BWC_ProductSheet_{0}", id);

            byte[] stream = pdf.GenerateFromHtml(html, fileName);

            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new ByteArrayContent(stream)
            };

            response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
            {
                FileName = fileName
            };
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

            return(response);
        }
Example #9
0
 public PdfWorkerError(PdfGenerationError code, GeneratePdf actorMessage)
     : base($"Error CODE = {code} when generating PDF")
 {
     Code         = code;
     ActorMessage = actorMessage;
 }
Example #10
0
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        if (IdfNo != "" || IdfNo != null)
        {
            con.ConnectionString = ConfigurationManager.ConnectionStrings["PATENTCN"].ConnectionString;
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");

            HttpContext.Current.Response.AppendHeader("Content-Type", "application/pdf");
            HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + IdfNo + "_overview.pdf");
            using (Document doc = new Document(PageSize.A4))
            {
                PdfWriter.GetInstance(doc, Response.OutputStream);
                doc.Open();
                string tTitle = "IDF Overview - " + IdfNo;
                doc.Add(new Paragraph(new Phrase(tTitle, new Font(Font.FontFamily.TIMES_ROMAN, 14, 1))));
                GeneratePdf gp = new GeneratePdf();

                if (chkboxIdf.Checked == true)
                {
                    string sql = "select title,type,InitialFiling,firstApplicant,secondApplicant," +
                                 "convert(varchar(10),request_dt,103) as request_dt from patdetails where fileno like '" + IdfNo + "'";
                    SqlDataAdapter sda = new SqlDataAdapter(sql, con);
                    DataTable      dt  = new DataTable();
                    sda.Fill(dt);
                    string[]  strTitle = new[] { "Title", "IDF Type", "Initial Filing", "First Applicant", "Second Applicant", "Request Date" };
                    PdfPTable table    = gp.MakePdf(dt, 2, "Invention Disclosure Form Details", strTitle);
                    doc.Add(table);

                    string sql1 = "select SlNo+1 as SlNo,InventorName,InventorType,InventorID,DeptOrOrganisation as Dept from coinventordetails where fileno like '" + IdfNo + "'" +
                                  "union select 1 as SlNo,Inventor1 as InventorName,InventorType,InstID as InventorID,Department as Dept from patdetails where fileno like '" + IdfNo + "'";
                    SqlDataAdapter sdb = new SqlDataAdapter(sql1, con);
                    DataTable      dt1 = new DataTable();
                    sdb.Fill(dt1);
                    string[]  strTitle1 = new[] { "Sl.No.", "Inventor Name", "Inventor Type", "Inventor ID", "Dept/Organization", };
                    PdfPTable table1    = gp.MakeTablePdf(dt1, 5, "Inventor Details", strTitle1);
                    doc.Add(table1);
                }
                if (chkboxIndian.Checked == true)
                {
                    string sql2 = "select Attorney,Applcn_no,convert(varchar(10),Filing_dt,103) as Filing_dt,Examination,convert(varchar(10),Exam_dt,103) as Exam_dt,Publication,convert(varchar(10),Pub_dt,103) as Pub_dt,Status,Sub_status," +
                                  "Pat_no,convert(varchar(10),Pat_dt,103) as Pat_dt from patdetails where fileno like '" + IdfNo + "'";
                    SqlDataAdapter sda1 = new SqlDataAdapter(sql2, con);
                    DataTable      dt1  = new DataTable();
                    sda1.Fill(dt1);
                    if (dt1.Rows.Count > 0)
                    {
                        string[]  strTitle1 = new[] { "Attorney", "Application Number", "Filing Date", "Examination", "Examination Date", "Publication", "Publication Date", "Patent Status", "Patent Sub Status", "Patent Grant Number", "Patent Issue Date" };
                        PdfPTable table1    = gp.MakePdf(dt1, 2, "Indian Patent Details", strTitle1);
                        doc.Add(table1);
                    }
                }
                if (chkboxComm.Checked == true)
                {
                    string sql3 = "select Commercial,InventionNo,convert(varchar(10),Validity_from_dt,103) as Validity_from_dt,convert(varchar(10),Validity_to_dt,103) as Validity_to_dt,Industry1,Industry2,IPC_Code," +
                                  "Abstract,DevelopmentStatus,Commercialized,PatentLicense,TechTransNo,Remarks from patdetails where fileno like '" + IdfNo + "'";
                    SqlDataAdapter sda3 = new SqlDataAdapter(sql3, con);
                    DataTable      dt3  = new DataTable();
                    sda3.Fill(dt3);
                    if (dt3.Rows.Count > 0)
                    {
                        string[]  strTitle3 = new[] { "Commercialization Responsibility", "Partner Reference No.", "Validity From Date", "Validity Till Date", "Industry", "Usage Area", "International Patent Classification(IPC) Code", "Abstract (Value Proposition)", "Development Status", "Commercialization Status", "Partner Agreement", "Technology Transfer No./Marketing No.", "Remark" };
                        PdfPTable table3    = gp.MakePdf(dt3, 2, "Commercialization Details", strTitle3);
                        doc.Add(table3);
                    }
                }
                if (chkboxInter.Checked == true)
                {
                    string sql4 = "select subFileNo,convert(varchar(10),RequestDt,103) as RequestDt,Country,Partner,PartnerNo,Type,Attorney,ApplicationNo,convert(varchar(10),FilingDt,103)as FilingDt," +
                                  "PublicationNo,convert(varchar(10),PublicationDt,103) as PublicationDt,Status,SubStatus,PatentNo,convert(varchar(10),PatentDt,103) as PatentDt,Remark from international where fileno like '" + IdfNo + "' order by subfileno";
                    SqlDataAdapter sda4 = new SqlDataAdapter(sql4, con);
                    DataTable      dt4  = new DataTable();
                    sda4.Fill(dt4);
                    if (dt4.Rows.Count > 0)
                    {
                        string[]  strTitle4 = new[] { "Sub File Number", "Request Date", "Country", "Partner", "Partner Number", "Invention Type", "Attorney", "Application Number", "Filing Date", "Publication Number", "Publication Date", "Patent Status", "Patent Sub Status", "Patent Grant Number", "Patent Grant Date", "Remark" };
                        PdfPTable table4    = gp.MakePdf(dt4, 2, "International Patent Details", strTitle4);

                        doc.Add(table4);
                    }
                }
                doc.Close();
                con.Close();
            }
            HttpContext.Current.Response.End();
        }
    }