| 1: | using System; | |
| 2: | using System.IO; | |
| 3: | ||
| 4: | using iTextSharp.text; | |
| 5: | using iTextSharp.text.pdf; | |
| 6: | ||
| 7: | ||
| 8: | namespace iTextSharp.tutorial.Chap02 | |
| 9: | { | |
| 10: | /// <summary> | |
| 11: | /// Phrase:Ancient Greek | |
| 12: | /// </summary> | |
| 13: | public class Chap0203 | |
| 14: | { | |
| 15: | public Chap0203() | |
| 16: | { | |
| 17: | ||
| 18: | Console.WriteLine("Chapter 2 example 3: Greek Characters"); | |
| 19: | ||
| 20: | // step 1: creation of a document-object | |
| 21: | Document document = new Document(); | |
| 22: | ||
| 23: | try | |
| 24: | { | |
| 25: | ||
| 26: | // step 2: | |
| 27: | // we create a writer that listens to the document | |
| 28: | // and directs a PDF-stream to a file | |
| 29: | PdfWriter.GetInstance(document, new FileStream("Chap0203.pdf",FileMode.Create)); | |
| 30: | ||
| 31: | // step 3: we open the document | |
| 32: | document.Open(); | |
| 33: | ||
| 34: | // step 4: we Add a paragraph to the document | |
| 35: | document.Add(new Phrase("What is the " + (char) 945 + "-coefficient of the " | |
| 36: | + (char) 946 + "-factor in the " + (char) 947 + "-equation?\n")); | |
| 37: | for (int i = 913; i < 970; i++) | |
| 38: | { | |
| 39: | document.Add(new Phrase(" " + i.ToString() + ": " + (char) i)); | |
| 40: | } | |
| 41: | } | |
| 42: | catch(DocumentException de) | |
| 43: | { | |
| 44: | Console.Error.WriteLine(de.Message); | |
| 45: | } | |
| 46: | catch(IOException ioe) | |
| 47: | { | |
| 48: | Console.Error.WriteLine(ioe.Message); | |
| 49: | } | |
| 50: | ||
| 51: | // step 5: we close the document | |
| 52: | document.Close(); | |
| 53: | ||
| 54: | } | |
| 55: | } | |
| 56: | } |