/// <summary> /// создание PDF с маршрутом /// </summary> /// <param name="path">путь к файлу</param> /// <param name="win">родительское окно</param> public void Create_PDF_File(string path, Routes_Window win) { var doc = new Document(); PdfWriter.GetInstance(doc, new FileStream(path, FileMode.Create)); doc.Open(); BaseFont base_font = BaseFont.CreateFont("arialn.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); iTextSharp.text.Phrase head = new Phrase("Маршрут", new iTextSharp.text.Font(base_font, 18, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Red))); iTextSharp.text.Paragraph header = new iTextSharp.text.Paragraph(head); header.Alignment = Element.ALIGN_CENTER; doc.Add(header); for (int i = 0; i < win.sorted_addresses.Count; i++) { string row = i.ToString() + ")" + win.sorted_addresses[i].ToString(); iTextSharp.text.Phrase text = new Phrase(row, new iTextSharp.text.Font(base_font, 14, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black))); iTextSharp.text.Paragraph main_text = new iTextSharp.text.Paragraph(text); doc.Add(main_text); } doc.Close(); }
private void bt_route_Click(object sender, RoutedEventArgs e) { Routes_Window route = new Routes_Window(); route.ShowDialog(); }