Java/PDF RTF/ZapfDingbatsNumberLists

Материал из Java эксперт
Перейти к: навигация, поиск

ZapfDingbatsNumberLists Demo

import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.GreekList;
import com.lowagie.text.ListItem;
import com.lowagie.text.RomanList;
import com.lowagie.text.ZapfDingbatsList;
import com.lowagie.text.ZapfDingbatsNumberList;
import com.lowagie.text.pdf.PdfWriter;
public class ZapfDingbatsNumberLists {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter.getInstance(document, new FileOutputStream("ZapfDingbatsNumberLists.pdf"));
      document.open();
      ZapfDingbatsNumberList z0 = new ZapfDingbatsNumberList(0, 15);
      z0.add(new ListItem("first item"));
      z0.add(new ListItem("second item"));
      document.add(z0);
      ZapfDingbatsNumberList z1 = new ZapfDingbatsNumberList(1, 15);
      z1.add(new ListItem("first item"));
      z1.add(new ListItem("second item"));
      document.add(z1);
      ZapfDingbatsNumberList z2 = new ZapfDingbatsNumberList(2, 15);
      z2.add(new ListItem("first item"));
      z2.add(new ListItem("second item"));
      document.add(z2);
      ZapfDingbatsNumberList z3 = new ZapfDingbatsNumberList(3, 15);
      z3.add(new ListItem("first item"));
      z3.add(new ListItem("second item"));
      document.add(z3);
    } catch (Exception ioe) {
      System.err.println(ioe.getMessage());
    }
    document.close();
  }
}