views:

67

answers:

0

Hi there, let me ask this questiom one more time, I have a table with some international characters and using iTextSharp to create PDF file. this is my code,some

charcters are missing and I need to have these characters as well.

Thanks in advance

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Response.ContentType = "application/pdf";

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

    Response.Cache.SetCacheability(HttpCacheability.NoCache);



    //Render PlaceHolder to temporary stream

    System.IO.StringWriter stringWrite = new System.IO.StringWriter();

    System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

    PlaceholderPdf.RenderControl(htmlWrite);



    System.IO.StringReader reader = new System.IO.StringReader(stringWrite.ToString());



    //Create PDF document

    Document doc = new Document(PageSize.A3);

    HTMLWorker parser = new HTMLWorker(doc);

    PdfWriter.GetInstance(doc, Response.OutputStream);



    doc.Open();



    try

    {

        //Create a footer that will display page number

        HeaderFooter footer = new HeaderFooter(new Phrase("This is page: "), true) { Border = Rectangle.NO_BORDER };

        doc.Footer = footer;



        //Parse Html

        parser.Parse(reader);

    }



    catch (Exception ex)

    {



       Paragraph paragraph = new Paragraph("Error! " + ex.Message);

       paragraph.SetAlignment("center");

       Chunk text = paragraph.Chunks[0] as Chunk;



        if (text != null)

        {

            text.Font.Color = Color.RED;

        }

        doc.Add(paragraph);

    }

    finally

    {

        doc.Close();

    }