{oapdf_gg}
The following is a sample of the output code above. In the above code to add at the end of document.close (); to close the document. Figure 1. above code sample output
You have to see how to add to the PDF document in plain text. Next, the need to add some of the complexity of the document element. We begin to create a new chapter. Section is a special section, by default, chapters from the beginning of a new page and displays a default number. List 4. To create sections of the object Paragraph title1 = new Paragraph ( "Chapter 1",
FontFactory.getFont (FontFactory.HELVETICA, \ 18, Font.BOLDITALIC, new Color (0, 0, 255 )));< br/> Chapter chapter1 = new Chapter (title1, 1); chapter1.setNumberDepth (0); In the above code to create a new section of the object, chapter1, entitled "This is Chapter 1", the code-level set to 0 will not be displayed on the page number section. Section is the section of the sub-elements. In the following code to create a title for the "This is Section 1 in Chapter 1" of the section. In the next section to add some text, the other paragraphs of the object created, someSectionText, and add it to sub-object. List of 5. Create a section object Paragraph title11 = new Paragraph ( "This is Section 1 in Chapter 1",
FontFactory.getFont (FontFactory.HELVETICA, 16, \ Font.BOLD, new Color (255, 0, 0 )));< br/> Section section1 = chapter1.addSection (title11); Paragraph someSectionText = new Paragraph ( "This \ text comes as part of section 1 of chapter 1 .");< br/> section1.add (someSectionText); someSectionText = new Paragraph ( "Following is a 3 X 2 table .");< br/> section1.add (someSectionText); Prior to adding the form, let us look at what the document looks like. Add the following two lines of code to close the document, and then compile and implement procedures to generate PDF documents: document.add (chapter1); document.close ();. Figure 2. sections of the output sample Next, create a Form object. Create a matrix that contains the ranks of the table. Cell line can cross a number of out. Similarly, the column of cells can also be across multiple lines. As a result, a 3 x 2 in fact does not necessarily have the form 6 cells. |