Example usage for com.itextpdf.text Rectangle TOP

List of usage examples for com.itextpdf.text Rectangle TOP

Introduction

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

Prototype

int TOP

To view the source code for com.itextpdf.text Rectangle TOP.

Click Source Link

Document

This represents one side of the border of the Rectangle.

Usage

From source file:Funciones.TicketPDF.java

PdfPTable tablaCliente() {
    PdfPTable tablacliente = new PdfPTable(2);
    tablacliente.setTotalWidth(500);//  www .  j  a  v a 2  s . c o m
    PdfPCell celdanombrecliente = new PdfPCell(new Paragraph("Nombre Del Cliente: " + cliente[0]));
    tablacliente.addCell(celdanombrecliente);
    PdfPCell celdavendedor = new PdfPCell(new Paragraph("Vendedor: APP"));
    tablacliente.addCell(celdavendedor);
    PdfPCell celdadireccion = new PdfPCell(new Paragraph("Direccion: " + cliente[1]));
    celdadireccion.setColspan(2);
    tablacliente.addCell(celdadireccion);
    ;
    vacio.setColspan(2);
    vacio.setBorder(Rectangle.BOTTOM | Rectangle.TOP);
    tablacliente.addCell(vacio);
    return tablacliente;
}

From source file:Funciones.TicketPDF.java

PdfPTable tablaLineas() {
    PdfPTable tablalineas = new PdfPTable(2);
    PdfPCell celdanombrepizza = new PdfPCell(new Paragraph("Nombre Pizza", f));
    tablalineas.addCell(celdanombrepizza);
    PdfPCell celdapreciopizza = new PdfPCell(new Paragraph("Precio", f));
    tablalineas.addCell(celdapreciopizza);
    for (int a = 0; a < cantidadlineas; a++) {
        for (int b = 0; b < 2; b++) {
            PdfPCell celda = new PdfPCell(new Paragraph(lineas[a][b], f));
            tablalineas.addCell(celda);//from w  w  w.jav a  2s  . c om
        }
    }
    vacio.setColspan(2);
    vacio.setBorder(Rectangle.BOTTOM | Rectangle.TOP);
    tablalineas.addCell(vacio);
    return tablalineas;
}

From source file:Funciones.TicketPDF.java

PdfPTable tablaFooter() {
    PdfPTable tablafooter = new PdfPTable(2);
    PdfPTable cantidades = new PdfPTable(2);

    PdfPCell celdasubtotal = new PdfPCell(new Paragraph("Subtotal", f));
    cantidades.addCell(celdasubtotal);//from w w w  .  j  a  v a 2 s.  com
    PdfPCell subtotalcantidad = new PdfPCell(new Paragraph("$" + totales[0], f));
    cantidades.addCell(subtotalcantidad);
    PdfPCell celdaiva = new PdfPCell(new Paragraph("I.V.A.", f));
    cantidades.addCell(celdaiva);
    PdfPCell ivacantidad = new PdfPCell(new Paragraph("$" + totales[1], f));
    cantidades.addCell(ivacantidad);
    PdfPCell celdatotal = new PdfPCell(new Paragraph("Total", f));
    cantidades.addCell(celdatotal);
    PdfPCell totalcantidad = new PdfPCell(new Paragraph("$" + totales[2], f));
    cantidades.addCell(totalcantidad);
    PdfPCell celdacantidades = new PdfPCell(cantidades);
    vacio = new PdfPCell(new Paragraph("!Que tenga un buen da!"));
    vacio.setColspan(1);
    vacio.setBorder(Rectangle.RIGHT | Rectangle.TOP | Rectangle.LEFT | Rectangle.BOTTOM);
    tablafooter.addCell(vacio);
    tablafooter.addCell(celdacantidades);
    return tablafooter;
}

From source file:fxml.test.PDFService.java

public PdfPTable createFooter2() {

    PdfPTable table = new PdfPTable(8);
    table.setHorizontalAlignment(Element.ALIGN_LEFT);

    try {//from  w ww. j  a v  a 2 s  .com
        table.setTotalWidth(new float[] { 192f, 144f, 5f, 144f, 5f, 144f, 5f, 144f });
        table.setLockedWidth(true);

    } catch (DocumentException ex) {
        Logger.getLogger(PDFService.class.getName()).log(Level.SEVERE, null, ex);
    }

    PdfPCell underLine = new PdfPCell(new Paragraph("_____________________"));
    underLine.setBorder(Rectangle.NO_BORDER);

    PdfPCell blankColumn = new PdfPCell(new Paragraph(" "));
    blankColumn.setBorder(Rectangle.NO_BORDER);

    PdfPCell blankColumn2 = new PdfPCell(new Paragraph(" "));
    blankColumn2.setBorder(Rectangle.BOTTOM);

    PdfPCell nameColumn = new PdfPCell(new Paragraph("Name :", font9));
    nameColumn.setBorder(Rectangle.NO_BORDER);
    nameColumn.setPaddingLeft(0f);

    PdfPCell cell3 = new PdfPCell(new Paragraph(inputs.get(7).trim(), font9));
    cell3.setPaddingRight(2);
    cell3.setBorder(Rectangle.TOP);

    PdfPCell cell4 = new PdfPCell(new Paragraph(inputs.get(8).trim(), font9));
    cell4.setBorder(Rectangle.TOP);

    PdfPCell cell5 = new PdfPCell(new Paragraph(inputs.get(9).trim(), font9));
    cell5.setBorder(Rectangle.TOP);

    PdfPCell cell6 = new PdfPCell(new Paragraph(inputs.get(10).trim(), font9));
    cell6.setBorder(Rectangle.TOP);

    PdfPCell memberSignature = new PdfPCell(new Paragraph("Signature of the Members:", font9));
    memberSignature.setPaddingLeft(0f);
    memberSignature.setBorder(Rectangle.NO_BORDER);

    table.addCell(memberSignature);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);

    table.addCell(nameColumn);
    table.addCell(cell3);
    table.addCell(blankColumn);
    table.addCell(cell4);
    table.addCell(blankColumn);
    table.addCell(cell5);
    table.addCell(blankColumn);
    table.addCell(cell6);

    PdfPCell tabulatorSignature = new PdfPCell(new Paragraph("Signature of the Tabulators:", font9));
    tabulatorSignature.setPaddingLeft(0f);
    tabulatorSignature.setPaddingTop(13f);
    tabulatorSignature.setBorder(Rectangle.NO_BORDER);

    table.addCell(tabulatorSignature);
    table.addCell(blankColumn2);
    table.addCell(blankColumn);
    table.addCell(blankColumn2);
    table.addCell(blankColumn);
    table.addCell(blankColumn2);
    table.addCell(blankColumn);
    table.addCell(blankColumn2);

    return table;

}

From source file:generators.InvoiceEventListener.java

@Override
public void onEndPage(PdfWriter writer, Document document) {

    Font defaultFont = new Font(Font.FontFamily.TIMES_ROMAN, 12);

    try {//from www.  j a  v  a 2  s.  c om
        PdfPTable footerTable = new PdfPTable(3);
        footerTable.setTotalWidth(document.right(document.leftMargin()));

        footerTable.getDefaultCell().setBorder(Rectangle.TOP);
        footerTable.addCell(new Paragraph("Lionsclub Oegstgeest/Warmond", defaultFont));
        footerTable.completeRow();

        footerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        footerTable.addCell(new Paragraph("Betaalrekening", defaultFont));
        footerTable.addCell(new Paragraph(": ************", defaultFont));
        footerTable.completeRow();
        footerTable.addCell(new Paragraph("Inschrijvnummer KvK Rijnland", defaultFont));
        footerTable.addCell(new Paragraph(": ************ ", defaultFont));
        footerTable.completeRow();
        footerTable.writeSelectedRows(0, -1, document.leftMargin(),
                document.bottom(footerTable.getTotalHeight()) - document.bottomMargin() + 15,
                writer.getDirectContent());

        ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT,
                new Phrase(String.format("%d", writer.getPageNumber()), defaultFont), document.right(),
                document.bottom() - document.bottomMargin() + 18, 0);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:generators.InvoiceGenerator.java

/**
 * Generate Invoice pdf file/*from w ww  .j a v  a  2 s.  c o m*/
 *
 * @param order the order
 * @throws DocumentException the document exception
 * @throws IOException       the io exception
 */
public void generate(Order order) throws DocumentException, IOException {
    Date invoiceDate = order.getDate();
    SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM YYYY");
    //        User guest = order.getGuest();
    User guest = new UserDAO().get(order.getUserId());
    guest.setOrder(order);
    System.out.println("invoice generator orderID: " + order.getId());
    Document document = new Document();
    Font defaultFont = new Font(Font.FontFamily.TIMES_ROMAN, 12);
    System.out.println(System.getProperty("user.dir"));
    PdfWriter writer = PdfWriter.getInstance(document,
            new FileOutputStream(System.getProperty("user.dir") + "/src/main/java/nl/ipsen3/invoice/"
                    + new SimpleDateFormat("dd-MM-yyyy").format(invoiceDate) + " - " + order.getId() + ".pdf"));
    document.setMargins(30, 30, 30, 65);
    writer.setPageEvent(new InvoiceEventListener());
    document.open();
    Paragraph header = new Paragraph("Lionsclub Oegstgeest/Warmond",
            new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD));
    header.setAlignment(Element.ALIGN_CENTER);
    document.add(header);
    AddressDAO addressDAO = new AddressDAO();
    Address userAddress = addressDAO.get(guest.getAddressId());
    Paragraph address = new Paragraph(guest.getFirstName() + " " + guest.getPrefixLastName() + " "
            + guest.getLastName() + "\n" + userAddress.getStreet() + " " + userAddress.getHouseNumber() + "\n"
            + userAddress.getZipCode() + " " + userAddress.getCity(), defaultFont);
    address.setSpacingBefore(35);
    address.setSpacingAfter(25);
    address.setLeading(15);
    document.add(address);

    Paragraph invoiceDetails = new Paragraph("Factuurdatum: " + sdf.format(invoiceDate) + "\n"
            + "FactuurNummer: " + order.getId() + " \n" + "Debiteurennummer: " + guest.getId(), defaultFont);

    invoiceDetails.setSpacingAfter(15);
    invoiceDetails.setLeading(15);
    document.add(invoiceDetails);

    Paragraph subject = new Paragraph("Betreft: Onderwerp factuur", defaultFont);
    subject.setSpacingAfter(30);
    document.add(subject);

    PdfPTable orderTable = new PdfPTable(10);
    PdfPCell wineCell = new PdfPCell(new Paragraph("Wijn", defaultFont));
    wineCell.setColspan(5);
    wineCell.setBorder(Rectangle.BOTTOM);
    orderTable.getDefaultCell().setPaddingBottom(10);
    orderTable.getDefaultCell().setBorder(Rectangle.BOTTOM);
    ;

    orderTable.addCell(new Paragraph("Code", defaultFont));
    orderTable.addCell(new Paragraph("Aantal", defaultFont));
    orderTable.addCell(wineCell);
    orderTable.addCell(new Paragraph("Jaar", defaultFont));
    orderTable.addCell(new Paragraph("Per Fles", defaultFont));
    orderTable.addCell(new Paragraph("Bedrag", defaultFont));

    orderTable.getDefaultCell().setPaddingBottom(0);
    orderTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    wineCell.setBorder(Rectangle.NO_BORDER);

    NumberFormat numberFormat = NumberFormat.getCurrencyInstance(Locale.GERMANY);

    for (WineOrder wineOrder : order.getWineOrders()) {
        orderTable.addCell(new Paragraph("" + wineOrder.getWine().getId(), defaultFont));
        orderTable.addCell(new Paragraph("" + wineOrder.getAmount(), defaultFont));
        wineCell.setPhrase(new Phrase(wineOrder.getWine().getName(), defaultFont));
        orderTable.addCell(wineCell);
        orderTable.addCell(new Paragraph("" + wineOrder.getWine().getYear(), defaultFont));
        orderTable.addCell(new Paragraph(
                " " + numberFormat.format(wineOrder.getWine().getPrice()).replace(" ", ""), defaultFont));
        orderTable.addCell(new Paragraph(" " + numberFormat
                .format(wineOrder.getAmount() * wineOrder.getWine().getPrice()).replace(" ", ""),
                defaultFont));

        orderTable.completeRow();
    }

    orderTable.addCell(" ");
    orderTable.completeRow();
    Font totalFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
    PdfPCell totalAmount = new PdfPCell(
            new Paragraph(" " + numberFormat.format(order.getTotalAmount()).replace(" ", ""), totalFont));
    totalAmount.setBorder(Rectangle.TOP);
    totalAmount.setPaddingTop(10);
    PdfPCell totalCell = new PdfPCell(new Paragraph("Totaal", totalFont));
    totalCell.setPaddingTop(10);
    totalCell.setBorder(Rectangle.NO_BORDER);
    orderTable.addCell(totalCell);
    PdfPCell fillerCell = new PdfPCell(new Paragraph(""));
    fillerCell.setColspan(8);
    fillerCell.setBorder(Rectangle.NO_BORDER);
    orderTable.addCell(fillerCell);
    orderTable.addCell(totalAmount);

    orderTable.setSpacingBefore(15);
    orderTable.setSpacingAfter(30);
    orderTable.setWidthPercentage(95);
    orderTable.setHorizontalAlignment(Element.ALIGN_CENTER);
    document.add(orderTable);

    Paragraph retrievalDetails = new Paragraph(
            "Wij verzoeken u vriendelijk het totaalbedrag binnen 7 dagen na factuurdatum over te maken op bankrekening <bankAccountNr> t.n.v <bankAccountName> onder vermelding van het factuurnummer",
            defaultFont);
    retrievalDetails.setLeading(15);
    retrievalDetails.setSpacingAfter(20);
    document.add(retrievalDetails);

    //        document.add(new Paragraph("U kunt uw wijnen ophalen op " +  sdf.format(invoiceDate) , defaultFont));
    //        document.add(new Paragraph("Adres:", defaultFont));
    //
    //        PdfPTable addressTable = new PdfPTable(1);
    //        addressTable.setSpacingBefore(5);
    //        addressTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    //        addressTable.getDefaultCell().setPaddingLeft(35);
    //        MerchantService merchantService = new MerchantService();
    //        Merchant merchant = merchantService.find(merchantService.all().get(0).getId());
    //        addressTable.addCell(new Paragraph(merchant.getName(), defaultFont));
    //        addressTable.addCell(new Paragraph(merchant.getAddress().getStreet()
    //                + " " + merchant.getAddress().getHouseNumber(), defaultFont));
    //        addressTable.addCell(new Paragraph(merchant.getAddress().getZipCode() + " " +
    //                merchant.getAddress().getCity(), defaultFont));
    //        addressTable.setHorizontalAlignment(Element.ALIGN_LEFT);
    //        document.add(addressTable);

    document.close();
    System.out.println(
            "Succesfully generated IPSEN2.invoice: " + order.getId() + " on Date: " + sdf.format(invoiceDate));
}

From source file:nl.infosys.hartigehap.barSystem.domain.Bon.java

/**
 * create the table for the PDF//w  ww  .j  a  v a  2s.c  o  m
 *
 * @return table
 */
private Paragraph table() {

    Paragraph par = new Paragraph();

    PdfPTable table = new PdfPTable(4);
    table.setWidthPercentage(100);
    table.getDefaultCell().setBorder(0);
    PdfPCell cell;

    Font fontbold = FontFactory.getFont("Times-Roman", 13, Font.BOLD);
    Font normal = FontFactory.getFont("Times-Roman", 13);

    table.addCell(new Phrase("Product:", fontbold));
    table.addCell(new Phrase("Prijs:", fontbold));
    table.addCell(new Phrase("Aantal:", fontbold));
    table.addCell(new Phrase("Totaalprijs:", fontbold));

    for (ImmutableProduct product : bestelling.getProducten()) {
        table.addCell(new Phrase(product.getNaam(), normal));
        table.addCell(new Phrase(product.getPrijsFormat(), normal));
        table.addCell(new Phrase(String.valueOf(product.getAantal()), normal));

        cell = new PdfPCell(new Phrase(product.getTotaalPrijsFormat(), normal));
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        cell.setPaddingBottom(5);
        table.addCell(cell);
    }

    cell = new PdfPCell(new Phrase("Excl. BTW", fontbold));
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(bestelling.getPrijsExclBtwFormat(), fontbold));
    cell.setColspan(3);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("BTW 21%", fontbold));
    cell.setBorder(0);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(bestelling.getBtwBedragFormat(), fontbold));
    cell.setColspan(4);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Incl. BTW", fontbold));
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(bestelling.getTotaalPrijsFormat(), fontbold));
    cell.setColspan(3);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);
    par.add(table);

    return par;
}

From source file:nl.infosys.hartigehap.barSystem.presentation.BonGui.java

private Paragraph table() {

    Paragraph par = new Paragraph();

    PdfPTable table = new PdfPTable(4);
    table.setWidthPercentage(100);/*from   w  w w  .  j  a  v a  2  s .c om*/
    table.getDefaultCell().setBorder(0);
    PdfPCell cell;

    Font fontbold = FontFactory.getFont("Times-Roman", 13, Font.BOLD);
    Font normal = FontFactory.getFont("Times-Roman", 13);

    table.addCell(new Phrase("Product:", fontbold));
    table.addCell(new Phrase("Prijs:", fontbold));
    table.addCell(new Phrase("Aantal:", fontbold));
    table.addCell(new Phrase("Totaalprijs:", fontbold));

    for (ImmutableProduct product : bestelling.getProducten()) {
        table.addCell(new Phrase(product.getNaam(), normal));
        table.addCell(new Phrase(product.getPrijsFormat(), normal));
        table.addCell(new Phrase(String.valueOf(product.getAantal()), normal));

        cell = new PdfPCell(new Phrase(product.getTotaalPrijsFormat(), normal));
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        cell.setPaddingBottom(5);
        table.addCell(cell);
    }

    cell = new PdfPCell(new Phrase("Excl. BTW", fontbold));
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(bestelling.getPrijsExclBtwFormat(), fontbold));
    cell.setColspan(3);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("BTW 21%", fontbold));
    cell.setBorder(0);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(bestelling.getBtwBedragFormat(), fontbold));
    cell.setColspan(4);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Incl. BTW", fontbold));
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(bestelling.getTotaalPrijsFormat(), fontbold));
    cell.setColspan(3);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);
    par.add(table);

    return par;
}

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterUnterschriftenLine(Font footerFont) throws DocumentException {
    PdfPCell leftCell = new PdfPCell(new Phrase("Schulleiter(in)", footerFont));
    leftCell.setBorder(Rectangle.TOP);
    leftCell.setBorderWidth(1f);/*from w  w  w. j a  v  a2  s. co m*/
    leftCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell centerCell = new PdfPCell(new Phrase("", footerFont));
    centerCell.setBorder(Rectangle.TOP);
    centerCell.setBorderWidth(1f);
    centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell rightCell = new PdfPCell(new Phrase("Klassenleiter(in)", footerFont));
    rightCell.setBorder(Rectangle.TOP);
    rightCell.setBorderWidth(1f);
    rightCell.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100f);
    table.addCell(leftCell);
    table.addCell(centerCell);
    table.addCell(rightCell);
    table.setWidths(new float[] { 0.3f, 0.3f, 0.3f });
    return table;
}

From source file:org.fossa.rolp.util.PdfFormatHelper.java

License:Open Source License

public static PdfPTable buildFooterKenntnisLine(Font footerFont) {
    PdfPCell cell = new PdfPCell(new Phrase("Kenntnis genommen: Erziehungsberechtigte", footerFont));
    cell.setBorder(Rectangle.TOP);
    cell.setBorderWidth(1f);//from  w  w w  . j  a  v a2  s  . com
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    PdfPTable table = new PdfPTable(1);
    table.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.setWidthPercentage(100f);
    table.addCell(cell);
    return table;
}