{oapdf_gg}
the first part of iText simple applicationChapter to create a Documentfiveuse iText to create a PDF document:helloword. a first step, create a iTextSharp.text.Document object instance: Document document = new Document (); the second step, creating a Writer for the Document example: PdfWriter.getInstance (document, new FileStream ( "Chap0101.pdf", FileMode.Create )); The third step is to open the current Document document.Open (); fourth step, for the current content of Document added: document.Add (new Paragraph ( "Hello World ")); the fifth step, close the Document document.Close (); complete sample code, see code 0101. in the case, it is not difficult to see that the production of a PDF document is very simple. Note:If you were in "document.Add (new Paragraph (" Hello World "));" the string "Hello Word" into Chinese, such as "This is my first PDF file", the result must let you disappointed, as PDF documents generated by the Chinese did not show up, do not worry, in Chapter 9 should be devoted to the issue of fonts, Chinese show will be solved, if not correctly display the Chinese, it there is no need for translation of this article. the following steps to do this in detail. |