// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; public class Chap0101 { public static void Main() { Console.WriteLine("Chapter 1 example 1: Hello World"); Document document = new Document(); try { PdfWriter.getInstance(document, new FileStream("C:\\Chap0101.pdf", FileMode.Create)); document.Open(); document.Add(new Paragraph("Hello World")); } catch(DocumentException de) { Console.Error.WriteLine(de.Message); } catch(IOException ioe) { Console.Error.WriteLine(ioe.Message); } document.Close(); } }