Example usage for com.itextpdf.text Rectangle getBorder

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

Introduction

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

Prototype

public int getBorder() 

Source Link

Document

Returns the exact type of the border.

Usage

From source file:direccion.GeneradorFormato.java

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

    Rectangle rect = writer.getBoxSize("art");
    Image imghead = null;/*from www. ja v a 2 s.  c  o m*/
    PdfContentByte cbhead = null;

    //        try {
    //            imghead = Image.getInstance("LogoSapito5.png");
    //            imghead.setAbsolutePosition(0, 0);
    //            imghead.setAlignment(Image.ALIGN_CENTER);
    //            imghead.scalePercent(10f);
    //            cbhead = writer.getDirectContent();
    //            PdfTemplate tp = cbhead.createTemplate(100, 150);
    //            tp.addImage(imghead);
    //            cbhead.addTemplate(tp, 100, 715);
    //        } catch (BadElementException e) {
    //            e.printStackTrace();
    //        } catch (IOException e) {
    //            e.printStackTrace();
    //        } catch (DocumentException e) {
    //            e.printStackTrace();
    //        }

    Phrase headPhraseImg = new Phrase(cbhead + "",
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 7, Font.NORMAL));

    Calendar c1 = Calendar.getInstance();
    Calendar c2 = new GregorianCalendar();
    String dia, mes, annio;
    dia = Integer.toString(c1.get(Calendar.DATE));
    mes = Integer.toString(c1.get(Calendar.MONTH));
    annio = Integer.toString(c1.get(Calendar.YEAR));
    Date fecha = new Date();
    String fechis = dia + "/" + mes + "/" + annio;

    Paragraph parrafo5 = new Paragraph(fechis,
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, Font.NORMAL, BaseColor.BLACK));
    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(parrafo5),
            rect.getRight(450), rect.getTop(-80), 0);

    Paragraph parrafo7 = new Paragraph("Empresa Sapito S.A. de C.V.",
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 16, Font.BOLD, BaseColor.BLACK));
    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(parrafo7),
            rect.getBottom(250), rect.getTop(-60), 0);

    Paragraph parrafo8 = new Paragraph("Reporte algoooooo",
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.BOLD, BaseColor.BLACK));
    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(parrafo8),
            rect.getBottom(250), rect.getTop(-40), 0);

    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_BOTTOM, new Phrase(
            "      _____________________________________________________________________________________    "),
            rect.getBorder(), rect.getTop(650), 0);

    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_BOTTOM, new Phrase(
            "      _____________________________________________________________________________________    "),
            rect.getBorder(), rect.getTop(-24), 0);

    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_BOTTOM, new Phrase(
            "      _____________________________________________________________________________________    "),
            rect.getBorder(), rect.getTop(-20), 0);

    Paragraph parrafo6 = new Paragraph(String.format("Pg %d", writer.getPageNumber()),
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, Font.NORMAL, BaseColor.BLACK));
    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(parrafo6),
            rect.getRight(-35), rect.getTop(-80), 0);
}