Example usage for com.itextpdf.text ListItem ListItem

List of usage examples for com.itextpdf.text ListItem ListItem

Introduction

In this page you can find the example usage for com.itextpdf.text ListItem ListItem.

Prototype

public ListItem(final Phrase phrase) 

Source Link

Document

Constructs a ListItem with a certain Phrase.

Usage

From source file:PDFmaker.java

private static void createList(Section subCatPart) {
    List list = new List(true, false, 10);
    list.add(new ListItem("First point"));
    list.add(new ListItem("Second point"));
    list.add(new ListItem("Third point"));
    subCatPart.add(list);/*from w ww.j ava  2  s . co  m*/
}

From source file:bl.pdf.PDFFile.java

private void createList(Section subCatPart) {
    List list = new List(true, false, 10);
    list.add(new ListItem("First point"));
    list.add(new ListItem("Second point"));
    list.add(new ListItem("Third point"));
    subCatPart.add(list);//from   w w  w .j a va  2 s  . c o m
}

From source file:com.centurylink.mdw.pdf.PdfExportHelper.java

License:Apache License

private void printAttributes(Section section, List<Attribute> attrs, int parentLevel) {
    Paragraph sTitle = new Paragraph("Activity Attributes", subSectionFont);
    Section subsection = section.addSection(sTitle, parentLevel == 0 ? 0 : (parentLevel + 1));
    com.itextpdf.text.List list = new com.itextpdf.text.List(false, false, 20.0f);
    for (Attribute attr : attrs) {
        if (excludeAttribute(attr.getAttributeName(), attr.getAttributeValue()))
            continue;
        Phrase phrase = new com.itextpdf.text.Phrase();
        phrase.add(new Chunk(attr.getAttributeName(), fixedWidthFont));
        String v = attr.getAttributeValue();
        if (v == null)
            v = "";
        phrase.add(new Chunk(": " + v, normalFont));
        list.add(new ListItem(phrase));
    }/*  www  .  j  a  v a  2  s  .c o m*/
    subsection.add(list);
}

From source file:com.centurylink.mdw.pdf.PdfExportHelper.java

License:Apache License

private void printVariables(Chapter chapter, List<Variable> variables, int parentLevel) {
    Paragraph sTitle = new Paragraph("Process Variables", sectionFont);
    Section section = chapter.addSection(sTitle, parentLevel == 0 ? 0 : (parentLevel + 1));
    com.itextpdf.text.List list = new com.itextpdf.text.List(false, false, 10.0f);
    for (Variable var : variables) {
        Phrase phrase = new Phrase();
        phrase.add(new Chunk(var.getName(), fixedWidthFont));
        String v = var.getType();
        if (var.getDescription() != null)
            v += " (" + var.getDescription() + ")";
        phrase.add(new Chunk(": " + v + "\n", normalFont));
        list.add(new ListItem(phrase));
    }//from   w ww.  j  ava  2s.  c  om
    section.add(list);
}

From source file:com.example.pdfcreate.MainActivity.java

private static void createList(Section subCatPart) {
    List list = new List(true, false, 10);
    list.add(new ListItem("First point"));
    list.add(new ListItem("Second point"));
    list.add(new ListItem("Third point"));
    // subCatPart.add(list);
}

From source file:com.github.wolfposd.imsqti2pdf.PDFCreator.java

License:Open Source License

private void addAnswerTexts(Paragraph paragraph, boolean showCorrectAnswer, Question question) {
    if (question.basetype == BaseType.IDENTIFIER) {
        List list = new List(false, 20);

        list.setListSymbol(SQUARE_CHUNK);
        for (String key : question.answers.keySet()) {
            String answer = question.answers.get(key);

            Double points = question.points.get(key);
            points = points == null ? 0 : points;
            if (showCorrectAnswer) {
                ListItem item = new ListItem(answer);
                item.getFont().setSize(OVERALLFONTSIZE);

                if (points > 0) {
                    item.getFont().setColor(39, 158, 35);
                } else {
                    // item.getFont().setColor(255, 0, 0);
                }/* w w  w  .  jav  a 2 s  . c  o m*/
                list.add(item);
            } else {
                ListItem item = new ListItem(answer);
                item.getFont().setSize(OVERALLFONTSIZE);
                list.add(item);
            }
        }

        paragraph.add(Chunk.NEWLINE);
        paragraph.add(list);
    } else if (question.basetype == BaseType.STRING) {
        paragraph.add(Chunk.NEWLINE);
        paragraph.add(Chunk.NEWLINE);

        if (showCorrectAnswer) {
            String key = question.points.keySet().iterator().next();
            Double points = question.points.get(key);

            paragraph.add(new Phrase(getXes(points) + " " + LocaleStrings.getString("answer") + " " + key));
        } else {
            paragraph.add(new Phrase(LocaleStrings.getString("answerLine")));
        }
    }
}

From source file:com.havoc.hotel.util.BookingPdf.java

public static String generateBookingPDF(Booking booking)
        throws DocumentException, FileNotFoundException, IOException {
    Document document = new Document(PageSize.A4);
    String bookingname = booking.getFirstName() + " " + booking.getLastName();
    document.addHeader("HOTEL HAVOC", "Hotel havoc Booking confirmation");
    PdfWriter writer = PdfWriter.getInstance(document,
            new FileOutputStream(FILE + "Booking" + "" + booking.getCustomer().getFirstName() + ".pdf "));
    writer.setViewerPreferences(PdfWriter.PageModeUseOC);
    writer.setPdfVersion(PdfWriter.VERSION_1_7);
    document.open();//from   w  ww.j av  a  2s . c  o m
    String html = htmlTemplate(booking);

    List unorderedList = new List(List.UNORDERED);

    unorderedList.add(new ListItem("Name       :" + booking.getFirstName() + " " + booking.getLastName()));
    //        unorderedList.add(new ListItem("Room Price :" + booking.getRoom().getRoomPrice()));
    unorderedList.add(new ListItem("Total Price :" + booking.getTotalPrice()));
    unorderedList.add(new ListItem("check in   :" + booking.getCheckinDate()));
    unorderedList.add(new ListItem("Total Nights:" + booking.getTotalNights()));
    unorderedList.add(new ListItem("check out  :" + booking.getCheckoutDate()));
    unorderedList.add(new ListItem("Booked By  :" + booking.getCustomer().getUsername()));

    document.add(unorderedList);
    document.close();
    return bookingname;

}

From source file:com.homecare.bo.EmployeeInfoBOImpl.java

@Scheduled(cron = "0 0 1 * * ?")
@Async//from ww w. j a v  a  2 s  . com
public void generatePDFAndEmailForAllActiveEmployees() {
    System.out.println("************************************Print All the Reminders");
    EmployeeInfo employeeInfoRequest = new EmployeeInfo();
    employeeInfoRequest.setStatus("A");
    List<EmployeeInfo> employeeList = employeeDAO.getAllEmployees(employeeInfoRequest);
    Map<Long, List<EmployeeInfo>> employeeListMap = getEmployeeListMap(employeeList);
    for (Long employerId : employeeListMap.keySet()) {
        List<EmployeeInfo> employees = employeeListMap.get(employerId);
        Document document = new Document();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            PdfWriter.getInstance(document, out);
            document.open();
            if (null != employees) {
                for (EmployeeInfo employeeInfo : employees) {
                    List<String> reminders = getRemindersByEmployee(employeeInfo);
                    com.itextpdf.text.List list = new com.itextpdf.text.List();
                    if (reminders != null && !reminders.isEmpty()) {
                        document.add(new Chunk(employeeInfo.getLastName() + " " + employeeInfo.getFirstName()));
                        for (String reminder : reminders) {
                            // Add the list items to list        
                            list.add(new ListItem(reminder));
                        }
                        document.add(list);
                        document.newPage();
                    }
                }
            }
            document.close();

            List<EmployerEmailInfo> employerEmailList = employerDAO.getAllEmployerEmails(employerId);
            EmailUtility emailUtility = new EmailUtility();
            emailUtility.sendEmailWithAttachment("Reminders of all the employees", employerEmailList,
                    out.toByteArray());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            //clean off           
            if (null != out) {
                try {
                    out.close();
                    out = null;
                } catch (Exception ex) {
                }
            }
        }
    }
}

From source file:com.vectorprint.report.itext.DefaultElementProducer.java

License:Open Source License

/**
 * Create a ListItem, style it and add the data
 *
 * @param data/* w  w w .  j a v  a  2  s.c  o  m*/
 * @param stylers
 * @return
 * @throws VectorPrintException
 */
public ListItem createListItem(Object data, Collection<? extends BaseStyler> stylers)
        throws VectorPrintException {
    return initTextElementArray(styleHelper.style(new ListItem(Float.NaN), data, stylers), data, stylers);
}

From source file:com.zaptech.pdfdemo.MainActivity.java

private void createList(Section section) {
    List list = new List(true, false, 10);
    list.add(new ListItem("First point"));
    list.add(new ListItem("Second point"));
    list.add(new ListItem("Third point"));
    section.add(list);//from  w w w. j a v a2s. co  m
}