Using system;
Using system. Collections. Generic;
Using system. text;
Using system. IO;
Using system. collections;
//
Using itextsharp; // download this DLL.
Using itextsharp. text;
Using itextsharp.text.pdf;
Namespace generator Generator
{
Class Program
{
Static void main (string [] ARGs)
{
Document document = new document ();
Using writer. getinstance (document, new filestream ("E: // test1.pdf", filemode. Create ));
// The generated signature file is test1.pdf.
Document. open ();
Basefont bfchinese = basefont. createfont ("C: \ Windows \ fonts \ simsun. TTC, 1", basefont. identity_h, basefont. not_embedded );
// Alignment: cell. horizontalalignment = element. align_center; cell. verticalignment = element. align_middle;
// Underline: Chunk chunk1 = new chunk ("this text is underlined", fontfactory. getfont (fontfactory. Helvetica, 12, Font. Underline ));
// Strikethrough: Chunk chunk2 = new chunk ("this font is of Type italic | strikethru", fontfactory. getfont (fontfactory. helvetica, 12, Font. italic | font. strikethru ));
Font fontchinese = new font (bfchinese, 14, Font. Underline, color. Red );
// Font fontchinese = new font (bfchinese, 12, Font. Normal, new color (0, 0, 0); // black
// Font fontchinese = new font (bfchinese, 12, Font. Normal, new color (0,255, 0); // green
Document. Add (new paragraph ("Hello, world", fontchinese ));
// Add textbox1 to PDF
Itextsharp. Text. Image JPEG = itextsharp. Text. image. getinstance ("01.jpg ");
Document. Add (JPEG );
// Returns the image 01.jpg to the left-side navigation pane.
Document. Close ();
}
}
}