Esempio n. 1
0
        public void Export()
        {
            Document doc      = new Document(PageSize.LETTER, 30, 30, 50, 50);
            BaseFont baseFont = BaseFont.CreateFont("C:\\Windows\\Fonts\\Arial.ttf", "windows-1254", true);

            iTextSharp.text.Font fontNormal = new iTextSharp.text.Font(baseFont, 14);
            var       desktopFolder         = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            var       fullFileName          = Path.Combine(desktopFolder, "Rapor.pdf");
            PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream(fullFileName, FileMode.OpenOrCreate));

            wri.SetLanguage("tr-TR");
            wri.ClearTextWrap();
            doc.Open();
            Paragraph p = new Paragraph("İZLENECEK ROTA", fontNormal);

            doc.Add(p);
            p = new Paragraph("GİDİŞ YOLU \n", fontNormal);
            doc.Add(p);
            foreach (var item in sort)
            {
                p = new Paragraph($"{item.Key} ", fontNormal);
                doc.Add(p);
                var element = lst.Where(q => q.address == item.Key.Substring(4)).Select(q => q).FirstOrDefault();
                p = new Paragraph($"İsim : {element.name} Gsm: {element.gsm }", fontNormal);
                doc.Add(p);
            }

            p = new Paragraph("DÖNÜŞ YOLU ", fontNormal);
            doc.Add(p);
            foreach (var item in returnSort)
            {
                p = new Paragraph($"{item.Key}", fontNormal);
                doc.Add(p);
                var element = returnlst.Where(q => q.address == item.Key.Substring(4)).Select(q => q).FirstOrDefault();
                p = new Paragraph($"İsim : {element.name} Gsm: {element.gsm }", fontNormal);
                doc.Add(p);
            }
            doc.Close();
        }