Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Write Marathi PDF

$
0
0

 Document pdfDoc = new Document(PageSize.A4, 10, 10, 10, 10);
            PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream);

            //Open PDF Document to write data
            pdfDoc.Open();

            //Assign Html content in a string to write in PDF
            string contents = "";

            StreamReader sr;
            try
            {
                //Read file from server path
                sr = File.OpenText(Server.MapPath("~/Forms/Payment_Details/HTMLPage/ChallanCheckList.htm"));
                //store content in the variable
                contents = sr.ReadToEnd();
                sr.Close();
                string strdate = DateTime.Now.ToString("MMMM") + ' ' + System.DateTime.Now.Year;
                decimal totalPrice1 = 0M;
                totalPrice1 =Convert.ToDecimal (TotAmt);
                Decimal  Total = totalPrice1 + 50;
            
               
            }
            catch (Exception ex)
            {

            }
            //Read string contents using stream reader and convert html to parsed conent
            var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(contents), null);

            //Get each array values from parsed elements and add to the PDF document
            foreach (var htmlElement in parsedHtmlElements)
                pdfDoc.Add(htmlElement as IElement);
            
            Response.ContentType = "application/pdf";
            ContentDisposition cd = new ContentDisposition
            {
                Inline = false,
                FileName = "Challan_"  + DateTime.Now.ToString().Replace(" ", "_").Replace("/", "_").Replace(":", "_").Replace("-", "_") + ".pdf"
            };

            Response.AddHeader("content-disposition", cd.ToString());

         
            pdfDoc.Close();
            System.Web.HttpContext.Current.Response.Write(pdfDoc);
            ReadPdfFile(pdfDoc, contents);
            Response.Flush();
            Response.End();

Above code is for generating PDF file but my content on html page is in Marathi and this pdf file shows only english font not marathi

I want marathi and English format PDF

Please Help Me.

Thanks


Viewing all articles
Browse latest Browse all 5678

Trending Articles