Hi,

I'm trying to use itextsharp for html to pdf convertion.

But some characters(Turkish) are missing in pdf.

How can i fix the code below for correct output.

             Response.ContentType = "application/pdf";

            Response.AddHeader("content-disposition",
"attachment;filename=GridViewExport.pdf");

            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            string html = @"<html xmlns='http://www.w3.org/1999/xhtml' >
                                <head runat='server'>            
                                                            <title></title>
                                                            </head>
                                                            <body>
                                                            <form id='form1'
runat='server'>
                                                            <div>
                                                            <table
border='1'>
                                                            <tr>
                                                            <td
style='color:green'>
                                                            ŞşĞğİiÇçĞğÜü
<td>
                                                            </tr>
                                                            </table>
                                                            </div>
                                                            </form>
                                                            </body>
                                                            </html>";
            html.Replace("Ş", "&#350;");
            
            StringReader sr =new StringReader(html);

            
            Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);


            PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc,
Response.OutputStream);

            pdfDoc.Open();

            List<IElement> lt = HTMLWorker.ParseToList(sr, null);

            ColumnText ct = new ColumnText(pdfWriter.DirectContent);

            ct.SetSimpleColumn(50, 50, PageSize.A4.Width - 50,
PageSize.A4.Height - 50);

            foreach (IElement t in lt)
            {
                ct.AddElement(t);
            }

            ct.Go();

            pdfDoc.Close();

            Response.Write(pdfDoc);

            Response.End();

Regards,
Clever61
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Problem-with-Html-Worker-Encoding-tp2298354p2298354.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to