Example usage for com.itextpdf.text TabSettings TabSettings

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

Introduction

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

Prototype

public TabSettings() 

Source Link

Usage

From source file:com.wesley.creche.services.pdf.createPdf.java

public void writePdfFinancialReport(String name, String startDate, String accStatus, String amountDue)
        throws DocumentException, IOException {

    createFolderIfNotExist();/*www .j a v a 2 s . c  o  m*/
    SQLQueries s = new SQLQueries();

    String lastName = "";

    try {
        lastName = s.getChildSurnameByName(name);
    } catch (SQLException | ClassNotFoundException ex) {
        System.out.println(ex);
    }

    Date date = new Date();
    DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
    String today = df.format(date);
    String fileName = "C:\\creche\\reports\\" + name + today + "_.pdf";

    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileName));

    document.open();

    addTitle(document);
    addLine(document);

    document.add(new Paragraph("Name : " + name + " " + lastName, italic));
    addEmptyLine(document, 2);

    Paragraph paragraph = new Paragraph();
    paragraph.add("Start Date :");
    paragraph.setTabSettings(new TabSettings());
    paragraph.add(Chunk.TABBING);
    paragraph.add(new Chunk(startDate));
    document.add(paragraph);

    addEmptyLine(document, 1);
    document.add(new Paragraph("Account Status : " + accStatus));
    addEmptyLine(document, 1);

    document.add(new Paragraph("Total Amount Outstanding : R" + amountDue));
    addEmptyLine(document, 3);

    addLine(document);
    document.add(new Paragraph("For any queries, please contact Administration : 10111"));

    document.close();
}