Blog

Friend's Note
Now testking will be offering complimentary preparation kit for 350-001 to the students who are preparing for 70-620 and 642-901.
 
1:   using System;
2:   using System.IO;
3:  
4:   using iTextSharp.text;
5:   using iTextSharp.text.pdf;
6:  
7:   namespace iTextSharp.tutorial.Chap01
8:   {
9:       /// <summary>
10:       /// Meta data + opening the document
11:       /// </summary>
12:       public class Chap0106
13:       {
14:           public Chap0106()
15:           {
16:               Console.WriteLine("Chapter 1 example 6: Meta Information");
17:           
18:               // step 1: creation of a document-object
19:               Document document new Document();
20:           
21:               try 
22:               {
23:               
24:                   // step 2:
25:                   // we create a writer that listens to the document
26:                   // and directs a PDF-stream to a file
27:               
28:                   PdfWriter.GetInstance(documentnew FileStream("Chap0106.pdf"FileMode.Create));
29:               
30:                   // step 3: we add some metadata and open the document
31:               
32:                   document.AddTitle("Hello World example");
33:                   document.AddSubject("This example explains step 6 in Chapter 1");
34:                   document.AddKeywords("Metadata, iText, step 6, tutorial");
35:                   document.AddCreator("My program using iText#");
36:                   document.AddAuthor("Bruno Lowagie");
37:                   document.AddHeader("Expires""0");
38:                   document.Open();
39:               
40:                   // step 4: we add a paragraph to the document
41:                   document.Add(new Paragraph("Hello World"));
42:               
43:               }
44:               catch(DocumentException de
45:               {
46:                   Console.Error.WriteLine(de.Message);
47:               }
48:               catch(IOException ioe
49:               {
50:                   Console.Error.WriteLine(ioe.Message);
51:               }
52:           
53:               // step 5: we close the document
54:               document.Close();
55:  
56:           }
57:       }
58:   }