// we add some metadata and open the document
document.addTitle("pdf测试");
document.addAuthor("张立华");
document.addKeywords("world");
// we Add a Watermark that will show up on PAGE 1
try
{
Watermark watermark = new Watermark(Image.getInstance("watermark.jpg"),200, 300);
document.Add(watermark);
}
catch
{
Console.Error.WriteLine("Are you sure you have the file 'watermark.jpg' in the right path?");
}
// we Add a Header that will show up on PAGE 1
HeaderFooter header = new HeaderFooter(new Phrase("hehe小"), false);
document.Header = header;
// step 3: we open the document
document.Open();
// step 4: we Add a paragraph to the document
// step 4: we Add some paragraphs to the document
for (int i = 0; i < 5; i++)
{
document.Add(new Paragraph("Hello World呵呵"));
}