0

I came to the point of desperation, so I need help from the experts. I am trying to do a program that exports invoice with itextsharp. During the creation of the PDF I noticed that Greek characters do not show in the PDF file at all. I already tried several solution from the site, but I could not make it to work. I am not experienced much with C sharp so I cannot make it to work. Not only I have to print out a few Greek characters but at some point I have to print a whole data grid view in Greek. Is there any way to make the itextsharp recognise Greek?? Below is my code, what ever I was able to do up to now. Any help would be appreciated. Thank you all in advance.

                    int.TryParse(Settings.Default["Invoice_counter"].ToString(), out counter); 
            counter++;
            Settings.Default["Invoice_counter"] = counter; 
            Settings.Default.Save(); 
            PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream(save.FileName, FileMode.Create));

            doc.Open();

            PdfPTable table = new PdfPTable(2);
            table.DefaultCell.Border = 0;

            Chunk no = new Chunk("Α.Φ.Τ: ..." + Environment.NewLine + Environment.NewLine + "Φ.Π.Α: ..." + Environment.NewLine + Environment.NewLine +  "No: " + counter);
            Paragraph invoice = new Paragraph("Invoice");


            iTextSharp.text.Image PNG = iTextSharp.text.Image.GetInstance("logo.png");
            PNG.ScalePercent(25f);                     
            table.AddCell(PNG);
            table.AddCell(no.ToString());

            doc.Add(table);
            doc.Add(invoice);
            doc.Close();
  • I'm thinking you need to set the language to Greek. Try wri.SetLanguage("el-GR"); – Sparrow Jan 26 '18 at 21:42
  • 3
    If you want to draw text with Greek letters, please use a font that has them. The default font does not. – mkl Jan 26 '18 at 23:48
  • I would be ashamed to say *I already tried several solution from the site, but I could not make it to work.* Two reasons: 1. you went to [the download page](https://developers.itextpdf.com/downloads) and decided not to use the latest version of iText. 2. You browsed the [tutorials](https://developers.itextpdf.com/tutorials) and didn't discover the font classes. – Bruno Lowagie Jan 27 '18 at 07:50
  • Thank you guys for your reply. @BrunoLowagie Sorry to offend you in any way. I am still learning. – Antreas Antreou Jan 27 '18 at 22:06

0 Answers0