1: | using System; | |
2: | using System.IO; | |
3: | ||
4: | using iTextSharp.text; | |
5: | using iTextSharp.text.pdf; | |
6: | using iTextSharp.text.xml; | |
7: | ||
8: | namespace iTextSharp.tutorial.Chap07 | |
9: | { | |
10: | /// <summary> | |
11: | /// Making life easy | |
12: | /// </summary> | |
13: | public class Chap0704 | |
14: | { | |
15: | ||
16: | public Chap0704() | |
17: | { | |
18: | ||
19: | Console.WriteLine("Chapter 7 example 4: making life easy"); | |
20: | ||
21: | // step 1: creation of a document-object | |
22: | Document documentA = new Document(PageSize.A4, 80, 50, 30, 65); | |
23: | ||
24: | // step 1: creation of a document-object | |
25: | Document documentB = new Document(PageSize.A4, 80, 50, 30, 65); | |
26: | ||
27: | try | |
28: | { | |
29: | ||
30: | // step 2: | |
31: | // we create a writer that listens to the document | |
32: | // and directs a XML-stream to a file | |
33: | PdfWriter.GetInstance(documentA, new FileStream("Chap0704a.pdf", FileMode.Create)); | |
34: | PdfWriter.GetInstance(documentB, new FileStream("Chap0704b.pdf", FileMode.Create)); | |
35: | ||
36: | // step 3: we parse the document | |
37: | XmlParser.Parse(documentA, "Chap0701.xml"); | |
38: | XmlParser.Parse(documentB, "Chap0703.xml", "tagmap0703.xml"); | |
39: | ||
40: | } | |
41: | catch(Exception e) | |
42: | { | |
43: | Console.Error.WriteLine(e.Message); | |
44: | Console.Error.WriteLine(e.StackTrace); | |
45: | } | |
46: | } | |
47: | } | |
48: | } |