public void Genratepdftext1(string murl, string fname) { try { string temp_path = ""; PdfConverter pdfobj = new PdfConverter(); string temp1 = ""; pdfobj.LicenseKey = "eVJIWUtLWUtZTFdJWUpIV0hLV0BAQEA="; pdfobj.PdfDocumentOptions.ShowHeader = false; pdfobj.PdfDocumentOptions.ShowFooter = false; string thisPageURL = HttpContext.Current.Request.Url.AbsoluteUri; thisPageURL = thisPageURL.Substring(0, thisPageURL.LastIndexOf('/')); string headerAndFooterHtmlUrl = thisPageURL.Substring(0, thisPageURL.LastIndexOf('/') + 1) + "Prints/header.htm"; pdfobj.PdfHeaderOptions.HtmlToPdfArea = new HtmlToPdfArea(headerAndFooterHtmlUrl); //enable header AddFooter(pdfobj); // set the header height in points pdfobj.PdfHeaderOptions.DrawHeaderLine = true; pdfobj.PdfHeaderOptions.HeaderHeight = 150; pdfobj.PdfHeaderOptions.HeaderText = ""; pdfobj.PdfHeaderOptions.HeaderSubtitleText = ""; pdfobj.PdfDocumentOptions.EmbedFonts = true; pdfobj.PdfDocumentInfo.AuthorName = "Cyber Best Technologies"; pdfobj.PdfDocumentInfo.Title = "Pharmacy Board"; pdfobj.PdfDocumentInfo.Subject = "Print LMS Forms"; //pdfobj.PdfDocumentInfo.Keywords = "HTML, PDF,Converter"; pdfobj.PdfDocumentInfo.CreatedDate = DateTime.Now; float width = (8.50f / 1.0f) * 72f; float height = (11 / 1.0f) * 72f; pdfobj.PdfDocumentOptions.AutoSizePdfPage = false; pdfobj.PdfDocumentOptions.PdfPageSize = PdfPageSize.Custom; pdfobj.PdfDocumentOptions.CustomPdfPageSize = new SizeF(width, height); pdfobj.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Portrait; pdfobj.PdfDocumentOptions.LeftMargin = 10; pdfobj.PdfDocumentOptions.RightMargin = 10; byte[] downloadBytes = pdfobj.GetPdfBytesFromHtmlStream(GenerateStreamFromString(txtcomplaint.Text), System.Text.Encoding.Default); System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); response.AddHeader("Content-Type", "binary/octet-stream"); response.AddHeader("Content-Disposition", "attachment; filename=" + fname + ".pdf; size=" + downloadBytes.Length.ToString()); response.BinaryWrite(downloadBytes); } catch (Exception EX) { //return ""; throw EX; } }