Example usage for com.itextpdf.text Rectangle BOX

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

Introduction

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

Prototype

int BOX

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

Click Source Link

Document

This represents a type of border.

Usage

From source file:facturacion.pdf.FacturaPdf.java

private PdfPCell getCellBox(String text) throws DocumentException, IOException {
    Chunk chunk = new Chunk();
    chunk.append(text);//  w  ww . ja  v a2s.c  om
    chunk.setFont(fontNormal);
    PdfPCell cell = new PdfPCell(new Paragraph(chunk));
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setBorder(Rectangle.BOX);
    return cell;
}

From source file:gov.nih.nci.firebird.service.registration.AbstractPdfWriterGenerator.java

License:Open Source License

PdfPCell createCell() {
    PdfPCell cell = new PdfPCell();
    cell.setPadding(CELL_PADDING_POINTS);
    cell.disableBorderSide(Rectangle.BOX);
    return cell;
}

From source file:gov.nih.nci.firebird.service.registration.AbstractPdfWriterGenerator.java

License:Open Source License

PdfPCell createCell(PdfPTable table) {
    PdfPCell cell = new PdfPCell(table);
    cell.disableBorderSide(Rectangle.BOX);
    return cell;
}

From source file:gov.nih.nci.firebird.service.registration.CvPdfGenerator.java

License:Open Source License

private void addContactInformationSection() throws DocumentException {
    contentHelper.addInstructionsHeader(getDocument(), getFromResources("cv.omb.header"));
    contentHelper.addInstructions(getDocument(), getFromResources("cv.omb.text"));
    contentHelper.addContactInformationHeader(getDocument());
    addSpacerRow();//from  w ww.j av a2 s .co m
    PdfPTable table = createTable(TWO_COLUMNS);
    contentHelper.addInvestigatorName(table, INVESTIGATOR_NAME_INDEX);
    contentHelper.addInvestigatorEmail(table, INVESTIGATOR_EMAIL_INDEX);
    contentHelper.addInvestigatorExternalId(table, INVESTIGATOR_EXTERNAL_ID_INDEX);
    contentHelper.addInvestigatorPhoneNumber(table, INVESTIGATOR_PHONE_NUMBER_INDEX);
    contentHelper.addInvestigatorAddress(table, INVESTIGATOR_ADDRESS_INDEX);

    PdfPTable rightTable = createTable(ONE_COLUMN);
    contentHelper.addInvestigatorProviderNumber(rightTable, INVESTIGATOR_PROVIDER_NUMBER_INDEX);
    contentHelper.addInvestigatorCtepId(rightTable, INVESTIGATOR_CTEP_ID_INDEX);
    PdfPCell tableCell = new PdfPCell(rightTable);
    tableCell.disableBorderSide(Rectangle.BOX);
    table.addCell(tableCell);
    getDocument().add(table);
}

From source file:gov.nih.nci.firebird.service.registration.SupplementalInvestigatorDataFormPdfGenerator.java

License:Open Source License

private void addContactInformationSection() throws DocumentException {
    contentHelper.addContactInformationHeader(getDocument());
    addSpacerRow();//ww  w  .  j  a v a 2 s.c o  m
    PdfPTable table = createTable(TWO_COLUMNS);
    contentHelper.addInvestigatorName(table, INVESTIGATOR_NAME_INDEX);
    contentHelper.addInvestigatorEmail(table, INVESTIGATOR_EMAIL_INDEX);
    contentHelper.addInvestigatorAddress(table, INVESTIGATOR_ADDRESS_INDEX);

    PdfPTable rightTable = createTable(ONE_COLUMN);
    contentHelper.addInvestigatorPhoneNumber(rightTable, INVESTIGATOR_PHONE_NUMBER_INDEX);
    contentHelper.addInvestigatorProviderNumber(rightTable, INVESTIGATOR_PROVIDER_NUMBER_INDEX);
    contentHelper.addInvestigatorCtepId(rightTable, INVESTIGATOR_CTEP_ID_INDEX);
    PdfPCell tableCell = new PdfPCell(rightTable);
    tableCell.disableBorderSide(Rectangle.BOX);
    table.addCell(tableCell);
    getDocument().add(table);
}

From source file:gov.nih.nci.firebird.service.registration.SupplementalInvestigatorDataFormPdfGenerator.java

License:Open Source License

private int addPrimaryOrganizationSection(int startIndex) throws DocumentException {
    int index = startIndex;
    contentHelper.addPrimaryOrganizationHeader(getDocument());
    addSpacerRow();/*from  w w w  . j  a  va 2s  .  c  om*/
    PdfPTable table = createTable(TWO_COLUMNS);
    contentHelper.addOrganizationName(table, index++);
    contentHelper.addOrganizationCtepId(table, index++);
    contentHelper.addOrganizationAddress(table, index++);

    PdfPTable rightTable = createTable(ONE_COLUMN);
    contentHelper.addOrganizationEmail(rightTable, index++);
    contentHelper.addOrganizationPhoneNumber(rightTable, index++);
    PdfPCell tableCell = new PdfPCell(rightTable);
    tableCell.disableBorderSide(Rectangle.BOX);
    table.addCell(tableCell);

    getDocument().add(table);
    return index;
}

From source file:GUI_Apoteker.Panel_Detil_PO.java

private void createPdf(List<detil_pesan_obat> a) {
    try {/*from   w ww  . ja v a 2s  .  c  o m*/
        JFileChooser saveFile = new JFileChooser();
        String namaFile = "D:/kampus/si-klinik-PO" + po.getId_Pemesanan_obat() + ".pdf";
        saveFile.setSelectedFile(new File(namaFile));
        String result = null;
        if (saveFile.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            result = saveFile.getSelectedFile().toString();
        } else {
            System.out.println("No Selection ");
        }

        // TODO add your handling code here:
        Document document = new Document();

        PdfWriter writer = null;
        try {
            writer = PdfWriter.getInstance(document, new FileOutputStream(result));
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Panel_Detil_PO.class.getName()).log(Level.SEVERE, null, ex);
        }
        document.open();
        PdfContentByte canvas = writer.getDirectContent();
        Rectangle rect = new Rectangle(50, 800, 550, 700);
        rect.setBorder(Rectangle.BOX);
        rect.setBorderWidth(5);
        rect.setBorderColor(BaseColor.BLACK);
        canvas.rectangle(rect);
        Paragraph preface;
        preface = getPreface("Bulanan");
        document.add(preface);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(createTableBulanan(a));
        document.close();
        open(result);
    } catch (DocumentException ex) {
        Logger.getLogger(Panel_Detil_PO.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:GUI_Apoteker.Panel_Detil_PO.java

private PdfPTable createTableBulanan(List<detil_pesan_obat> a) {
    PdfPTable tabel = new PdfPTable(2);
    PdfPCell cell;//w  w  w  . j  a v a2 s . c  o m
    cell = new PdfPCell(new Phrase(("Nama Obat"), font6));
    cell.setRowspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    tabel.addCell(cell);
    cell = new PdfPCell(new Phrase(("Jumlah Obat yang dipesan"), font6));
    cell.setRowspan(2);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    tabel.addCell(cell);
    for (int i = 0; i < a.size(); i++) {
        cell = new PdfPCell(new Phrase(("" + a.get(i).getNama_Obat()), font5));
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        tabel.addCell(cell);

        cell = new PdfPCell(new Phrase(("" + a.get(i).getJumlah_Pesan()), font5));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabel.addCell(cell);
    }
    return tabel;
}

From source file:GUI_StafKlinik.Panel_Laporan_Keuangan.java

private void createPdf(List<Laporan_Keuangan> list) {
    JFileChooser saveFile = new JFileChooser();
    saveFile.setSelectedFile(new File("D:/document/Laporan Keuangan.pdf"));
    String result = null;//from   ww w .  ja  va 2s  . c  o  m
    if (saveFile.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
        result = saveFile.getSelectedFile().toString();
    } else {
        System.out.println("No Selection ");
    }
    try {
        // TODO add your handling code here:
        Document document = new Document();
        try {
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(result));
            document.open();
            PdfContentByte canvas = writer.getDirectContent();
            Rectangle rect = new Rectangle(50, 800, 550, 700);
            rect.setBorder(Rectangle.BOX);
            rect.setBorderWidth(0);
            rect.setBorderColor(BaseColor.BLACK);
            canvas.rectangle(rect);
            Paragraph preface;
            preface = getPreface("Laporan Keuangan");
            document.add(preface);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(createTableLaporan(list));
            document.close();
            open(result);
        } catch (DocumentException ex) {
            Logger.getLogger(Panel_Laporan_Keuangan.class.getName()).log(Level.SEVERE, null, ex);
        }
    } catch (FileNotFoundException ex) {
        Logger.getLogger(Panel_Laporan_Keuangan.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:GUI_StafKlinik.Panel_Laporan_Keuangan.java

private PdfPTable createTableLaporan(List<Laporan_Keuangan> list) {
    PdfPTable tabel = new PdfPTable(6);
    PdfPCell cell;/*  ww  w .j  a  v  a2 s.c o  m*/
    cell = new PdfPCell(new Phrase(("Tanggal"), font6));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setRowspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    tabel.addCell(cell);
    cell = new PdfPCell(new Phrase(("Keterangan"), font6));
    cell.setRowspan(1);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    tabel.addCell(cell);
    cell = new PdfPCell(new Phrase(("Ref"), font6));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setRowspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    tabel.addCell(cell);
    cell = new PdfPCell(new Phrase(("Pemasukan"), font6));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setRowspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    tabel.addCell(cell);
    cell = new PdfPCell(new Phrase(("Pengeluaran"), font6));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setRowspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    tabel.addCell(cell);
    cell = new PdfPCell(new Phrase(("Saldo"), font6));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    tabel.addCell(cell);

    for (int i = 0; i < list.size(); i++) {
        cell = new PdfPCell(new Phrase(("" + list.get(i).getTanggal()), font5));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabel.addCell(cell);

        cell = new PdfPCell(new Phrase(("" + list.get(i).getKeterangan()), font5));
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        tabel.addCell(cell);

        cell = new PdfPCell(new Phrase(("" + list.get(i).getRef()), font5));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabel.addCell(cell);

        cell = new PdfPCell(new Phrase(("" + list.get(i).getPemasukan()), font5));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabel.addCell(cell);

        cell = new PdfPCell(new Phrase(("" + list.get(i).getPengeluaran()), font5));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabel.addCell(cell);

        cell = new PdfPCell(new Phrase(("" + list.get(i).getSaldo()), font5));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabel.addCell(cell);
    }
    return tabel;
}