using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
public class AddImage{
public static void Main() {
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileStream("Example.pdf", FileMode.Create));
document.Open();
Image wmf = Image.getInstance(new Uri("http://itextsharp.sourceforge.net/examples/harbour.wmf"));
Image gif = Image.getInstance(new Uri("http://itextsharp.sourceforge.net/examples/vonnegut.gif"));
Image jpeg = Image.getInstance(new Uri("http://itextsharp.sourceforge.net/examples/myKids.jpg"));
Image png = Image.getInstance(new Uri("http://itextsharp.sourceforge.net/examples/hitchcock.png"));
document.Add(wmf);
document.Add(gif);
document.Add(jpeg);
document.Add(png);
}
catch(DocumentException de) {
Console.Error.WriteLine(de.Message);
}
catch(IOException ioe) {
Console.Error.WriteLine(ioe.Message);
}
document.Close();
}
}
No comments:
Post a Comment