Java/PDF RTF/GreekLists

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

GreekLists Example

import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.GreekList;
import com.lowagie.text.ListItem;
import com.lowagie.text.pdf.PdfWriter;
//Greek letter list
public class GreekListsPDF {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter.getInstance(document, new FileOutputStream("GreekListsPDF.pdf"));
      document.open();
      GreekList greek = new GreekList(15);
      greek.setGreekLower(true);
      greek.add(new ListItem("first item"));
      greek.add(new ListItem("second item"));
      for (int i = 3; i < 20; i++) {
        greek.add(i + "th item");
      }
      document.add(greek);
    } catch (Exception ioe) {
      System.err.println(ioe.getMessage());
    }
    document.close();
  }
}