Adding Chunk to Paragraph
import java.io.FileOutputStream; import com.lowagie.text.Chunk; import com.lowagie.text.Document; import com.lowagie.text.Font; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfWriter; public class AddingChunkToParagraphPDF { public static void main(String[] args) { try { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("AddingChunkToParagraphPDF.pdf")); document.open(); Paragraph p = new Paragraph(); p.add(new Chunk("Font.TIMES_ROMAN", new Font(Font.TIMES_ROMAN, 12))); document.add(new Paragraph(p)); document.close(); } catch (Exception de) { de.printStackTrace(); } } }
1. | Three Paragraphs | ![]() | |
2. | Adding List to Paragraph | ![]() | |
3. | Adding Chunk and Phrase to Paragraph | ![]() | |
4. | Long Paragraph in PDF | ![]() | |
5. | Generates a simple 'Hello World' PDF file | ![]() | |
6. | Adding Paragraph to a Page | ![]() |