Example usage for com.lowagie.text.pdf PdfName I

List of usage examples for com.lowagie.text.pdf PdfName I

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfName I.

Prototype

PdfName I

To view the source code for com.lowagie.text.pdf PdfName I.

Click Source Link

Document

A name

Usage

From source file:questions.forms.MultipleChoice.java

public static void createPdf() throws IOException, DocumentException {
    // step 1/*from   w ww .  j a  v  a2 s .  c  o  m*/
    Document document = new Document();
    // step 2
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT));
    // step 3
    document.open();
    // step 4
    TextField field = new TextField(writer, new Rectangle(36, 750, 144, 806), "iText");
    field.setFontSize(9);
    String[] list_options = { "JAVA", "C", "CS", "VB", "PHP" };
    field.setChoiceExports(list_options);
    String[] list_values = { "Java", "C/C++", "C#", "VB", "PHP" };
    field.setChoices(list_values);
    PdfFormField f = field.getListField();
    f.setFieldFlags(PdfFormField.FF_MULTISELECT);
    f.put(PdfName.I, new PdfArray(new int[] { 0, 2 }));
    writer.addAnnotation(f);
    // step 5
    document.close();
}