Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Bullet List in PDF with iText
How to create a PDF document with Bullet Lists using iText Java Library?
✍: FYIcenter.com
Here is a tutorial for creating a PDF document with Bullet Lists using iText Java Library.
1. Create a Java file, BulletList.java:
/** * A buttet list PDF with iText */ import com.itextpdf.kernel.pdf.*; import com.itextpdf.kernel.font.*; import com.itextpdf.layout.*; import com.itextpdf.layout.element.*; import com.itextpdf.io.font.*; import java.io.*; public class BulletList { public static void main(String args[]) throws IOException { PdfWriter writer = new PdfWriter("list.pdf"); PdfDocument pdf = new PdfDocument(writer); Document document = new Document(pdf); PdfFont font = PdfFontFactory.createFont(FontConstants.TIMES_ROMAN); document.add(new Paragraph("iText is:").setFont(font)); List list = new List() .setSymbolIndent(12) .setListSymbol("\u2022") .setFont(font); list.add(new ListItem("Never gonna give you up")) .add(new ListItem("Never gonna let you down")) .add(new ListItem("Never gonna run around and desert you")) .add(new ListItem("Never gonna make you cry")) .add(new ListItem("Never gonna say goodbye")) .add(new ListItem("Never gonna tell a lie and hurt you")); document.add(list); document.close(); } }
2. Run the Java program iText 7 Java Library.
fyicenter$ java -cp java -cp kernel-7.1.4.jar:layout-7.1.4.jar: \ io-7.1.4.jar:slf4j-api-1.7.31.jar \ BulletList.java fyicenter$ ls -l *.pdf 1072 list.pdf
3. View the new PDF, list.pdf, in a browser. You see a PDF page with a list of short messages.
⇒ Embed Image in PDF with iText
⇐ Create PDF with iText Java Library
2021-11-30, 2627🔥, 0💬
Popular Posts:
JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "jav...
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
JDK 11 jdk.crypto.mscapi.jmod is the JMOD file for JDK 11 Crypto MSCAPI module. JDK 11 Crypto MSCAPI...
Java Cryptography Extension 1.2.2 JAR File Size and Download Location: File name: jce.jar, jce-1.2.2...
JDK 11 jdk.internal.opt.jmod is the JMOD file for JDK 11 Internal Opt module. JDK 11 Internal Opt mo...