Example usage for com.lowagie.text.pdf PdfPCell setBorderWidth

List of usage examples for com.lowagie.text.pdf PdfPCell setBorderWidth

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPCell setBorderWidth.

Prototype

public void setBorderWidth(float borderWidth) 

Source Link

Document

Sets the borderwidth of the table.

Usage

From source file:com.krawler.spring.exportFunctionality.exportDAOImpl.java

License:Open Source License

public void addTitleSubtitle(Document d) throws ServiceException {
    try {// w ww.ja v  a 2s . c  om
        java.awt.Color tColor = new Color(Integer.parseInt(config.getString("textColor"), 16));
        PdfPTable table = new PdfPTable(1);
        table.setHorizontalAlignment(Element.ALIGN_CENTER);

        table.setWidthPercentage(100);
        table.setSpacingBefore(6);

        //Report Title
        PdfPCell cell = new PdfPCell(new Paragraph(
                fontFamilySelector.process(config.getString("title"), FontContext.REPORT_TITLE, tColor)));//fontBold));
        cell.setBorder(0);
        cell.setBorderWidth(0);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell);

        //Report Subtitle(s)
        String[] SubTitles = config.getString("subtitles").split("~");// '~' as separator
        for (int i = 0; i < SubTitles.length; i++) {
            cell = new PdfPCell(
                    new Paragraph(fontFamilySelector.process(SubTitles[i], FontContext.REPORT_TITLE, tColor)));
            cell.setBorder(0);
            cell.setBorderWidth(0);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(cell);
        }
        table.setSpacingAfter(6);
        d.add(table);

        //Separator line
        PdfPTable line = new PdfPTable(1);
        line.setWidthPercentage(100);
        PdfPCell cell1 = null;
        cell1 = new PdfPCell(new Paragraph(""));
        cell1.setBorder(PdfPCell.BOTTOM);
        line.addCell(cell1);
        d.add(line);
    } catch (Exception e) {
        throw ServiceException.FAILURE("exportDAOImpl.addTitleSubtitle", e);
    }
}

From source file:com.krawler.spring.exportFunctionality.exportMPXDAOImpl.java

License:Open Source License

public void addTitleSubtitle(Document d) throws ServiceException {
    try {/*from  ww w. ja v  a 2s . c  o  m*/
        java.awt.Color tColor = new Color(Integer.parseInt(config.getString("textColor"), 16));
        //            fontBold.setColor(tColor);
        //            fontRegular.setColor(tColor);
        PdfPTable table = new PdfPTable(1);
        table.setHorizontalAlignment(Element.ALIGN_CENTER);

        table.setWidthPercentage(100);
        table.setSpacingBefore(6);

        //Report Title
        PdfPCell cell = new PdfPCell(new Paragraph(
                fontFamilySelector.process(config.getString("title"), FontContext.REPORT_TITLE, tColor)));
        cell.setBorder(0);
        cell.setBorderWidth(0);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(cell);

        //Report Subtitle(s)
        String[] SubTitles = config.getString("subtitles").split("~");// '~' as separator
        for (int i = 0; i < SubTitles.length; i++) {
            cell = new PdfPCell(new Paragraph(
                    (new Phrase(fontFamilySelector.process(SubTitles[i], FontContext.FOOTER_NOTE)))));
            cell.setBorder(0);
            cell.setBorderWidth(0);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(cell);
        }
        table.setSpacingAfter(6);
        d.add(table);

        //Separator line
        PdfPTable line = new PdfPTable(1);
        line.setWidthPercentage(100);
        PdfPCell cell1 = null;
        cell1 = new PdfPCell(new Paragraph(""));
        cell1.setBorder(PdfPCell.BOTTOM);
        line.addCell(cell1);
        d.add(line);
    } catch (Exception e) {
        throw ServiceException.FAILURE("exportDAOImpl.addTitleSubtitle", e);
    }
}

From source file:com.qcadoo.mes.orders.print.OrderReportPdf.java

License:Open Source License

private PdfPCell createCell(String content, int alignment) {
    PdfPCell cell = new PdfPCell();
    float border = 0.2f;
    cell.setPhrase(new Phrase(content, FontUtils.getDejavuRegular7Dark()));
    cell.setHorizontalAlignment(alignment);
    cell.setBorderWidth(border);
    cell.disableBorderSide(PdfPCell.RIGHT);
    cell.disableBorderSide(PdfPCell.LEFT);
    cell.setPadding(5);/*from ww  w  .  jav  a  2 s  .co m*/
    return cell;
}

From source file:com.silverpeas.kmelia.workflowextensions.SendInKmelia.java

License:Open Source License

private void generatePDFStepContent(HistoryStep step, com.lowagie.text.Document document) {
    try {// www .jav  a2 s. c o  m
        Form form;
        if ("#question#".equals(step.getAction()) || "#response#".equals(step.getAction())) {
            // TODO
            form = null;
        } else {
            form = getProcessInstance().getProcessModel().getPresentationForm(step.getAction(), getRole(),
                    getLanguage());
        }

        XmlForm xmlForm = (XmlForm) form;
        if (xmlForm != null && step.getActionRecord() != null) {
            DataRecord data = step.getActionRecord();
            VersioningUtil versioningUtil = new VersioningUtil();

            // Force simpletext displayers because itext cannot display HTML Form fields (select,
            // radio...)
            float[] colsWidth = { 25, 75 };
            PdfPTable tableContent = new PdfPTable(colsWidth);
            tableContent.setWidthPercentage(100);

            PdfPCell cell = null;
            Field field;
            String fieldLabel;
            String fieldValue = "";
            Font fontLabel = new Font(Font.HELVETICA, 10, Font.BOLD);
            Font fontValue = new Font(Font.HELVETICA, 10, Font.NORMAL);
            List<FieldTemplate> fieldTemplates = xmlForm.getFieldTemplates();
            for (FieldTemplate fieldTemplate1 : fieldTemplates) {
                GenericFieldTemplate fieldTemplate = (GenericFieldTemplate) fieldTemplate1;

                fieldLabel = fieldTemplate.getLabel("fr");
                field = data.getField(fieldTemplate.getFieldName());
                String componentId = step.getProcessInstance().getProcessModel().getModelId();

                //          fieldValue = data.getField(fieldTemplate.getFieldName()).getValue();
                //wysiwyg field
                if ("wysiwyg".equals(fieldTemplate.getDisplayerName())) {
                    String file = WysiwygFCKFieldDisplayer.getFile(componentId,
                            getProcessInstance().getInstanceId(), fieldTemplate.getFieldName(), getLanguage());

                    //Extract the text content of the html code
                    Source source = new Source(file);
                    if (source != null) {
                        fieldValue = source.getTextExtractor().toString();
                    }
                }
                //Field file type
                else if (FileField.TYPE.equals(fieldTemplate.getDisplayerName())
                        && StringUtil.isDefined(field.getValue())) {
                    boolean fromCompoVersion = "yes".equals(getOrganizationController()
                            .getComponentParameterValue(componentId, "versionControl"));
                    //Versioning Used
                    if (fromCompoVersion) {
                        DocumentVersion documentVersion = versioningUtil
                                .getDocumentVersion(new DocumentVersionPK(Integer.parseInt(field.getValue())));
                        if (documentVersion != null) {
                            fieldValue = documentVersion.getLogicalName();
                        }
                    } else {
                        AttachmentDetail attDetail = AttachmentController
                                .searchAttachmentByPK(new AttachmentPK(field.getValue(), componentId));
                        if (attDetail != null) {
                            fieldValue = attDetail.getLogicalName(getLanguage());
                        }
                    }
                }
                //Field date type
                else if (fieldTemplate.getTypeName().equals("date")) {
                    fieldValue = DateUtil.getOutputDate(fieldValue, "fr");
                }
                //Others fields type
                else {
                    fieldTemplate.setDisplayerName("simpletext");
                    fieldValue = field.getValue(getLanguage());
                }

                cell = new PdfPCell(new Phrase(fieldLabel, fontLabel));
                cell.setBorderWidth(0);
                cell.setPaddingBottom(5);
                tableContent.addCell(cell);

                cell = new PdfPCell(new Phrase(fieldValue, fontValue));
                cell.setBorderWidth(0);
                cell.setPaddingBottom(5);
                tableContent.addCell(cell);
            }

            document.add(tableContent);
        }
    } catch (Exception e) {
        SilverTrace.error("workflowEngine", "SendInKmelia.generatePDFStep()", "root.MSG_GEN_ERROR", e);
    }
}

From source file:com.slamd.report.PDFReportGenerator.java

License:Open Source License

/**
 * Performs the appropriate action necessary when starting a new page.  In
 * this case, we will write the SLAMD header to the top of the page.
 *
 * @param  writer    The writer used to write the PDF document.
 * @param  document  The PDF document being written.
 *//* w  w  w.ja  va 2 s  .c  o  m*/
public void onStartPage(PdfWriter writer, Document document) {
    try {
        PdfPTable table = new PdfPTable(3);
        table.setWidthPercentage(100);

        PdfPCell blueCell = new PdfPCell(new Phrase(" \n "));
        blueCell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        blueCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        blueCell.setBackgroundColor(new Color(0x59, 0x4F, 0xBF));
        blueCell.setBorderWidth(inchesToPoints(1.0 / 16));
        blueCell.setBorderColor(new Color(0xFF, 0xFF, 0xFF));
        blueCell.setPadding(inchesToPoints(1.0 / 16));
        table.addCell(blueCell);

        Phrase titlePhrase = new Phrase("SLAMD Generated Report",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, new Color(0x59, 0x4F, 0xBF)));
        PdfPCell yellowCell = new PdfPCell(titlePhrase);
        yellowCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        yellowCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        yellowCell.setBackgroundColor(new Color(0xFB, 0xE2, 0x49));
        yellowCell.setBorderWidth(inchesToPoints(1.0 / 16));
        yellowCell.setBorderColor(new Color(0xFF, 0xFF, 0xFF));
        yellowCell.setPadding(inchesToPoints(1.0 / 16));
        table.addCell(yellowCell);

        Phrase versionPhrase = new Phrase("Version " + DynamicConstants.SLAMD_VERSION,
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, new Color(0xFF, 0xFF, 0xFF)));
        PdfPCell redCell = new PdfPCell(versionPhrase);
        redCell.setHorizontalAlignment(Cell.ALIGN_RIGHT);
        redCell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
        redCell.setBackgroundColor(new Color(0xD1, 0x21, 0x24));
        redCell.setBorderWidth(inchesToPoints(1.0 / 16));
        redCell.setBorderColor(new Color(0xFF, 0xFF, 0xFF));
        redCell.setPadding(inchesToPoints(1.0 / 16));
        table.addCell(redCell);

        document.add(table);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:de.jdufner.sudoku.generator.pdf.PdfCellHandler.java

License:Open Source License

private void formatZelle(final int zeile, final int spalte, final PdfPCell cell) {
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setBorderColor(new Color(//
            Integer.parseInt(getPdfStyle().getProperty("sudoku.board.border.color.red")), //
            Integer.parseInt(getPdfStyle().getProperty("sudoku.board.border.color.green")), //
            Integer.parseInt(getPdfStyle().getProperty("sudoku.board.border.color.blue"))));

    if (isEvenBlockIndex(zeile, spalte)) {
        cell.setBackgroundColor(new Color(//
                Integer.parseInt(getPdfStyle().getProperty("sudoku.board.background.odd.color.red")), //
                Integer.parseInt(getPdfStyle().getProperty("sudoku.board.background.odd.color.green")), //
                Integer.parseInt(getPdfStyle().getProperty("sudoku.board.background.odd.color.blue"))));
    } else {//from   ww  w .j av  a 2 s . c om
        cell.setBackgroundColor(new Color(//
                Integer.parseInt(getPdfStyle().getProperty("sudoku.board.background.even.color.red")), //
                Integer.parseInt(getPdfStyle().getProperty("sudoku.board.background.even.color.green")), //
                Integer.parseInt(getPdfStyle().getProperty("sudoku.board.background.even.color.blue"))));
    }
    cell.setBorderWidth(PdfConstants.RAHMEN_DUENN);
    if (BoxUtils.isFirstRowInBlock(zeile, getSudokuSize())) {
        cell.setBorderWidthTop(PdfConstants.RAHMEN_DICK);
    } else {
        cell.setBorderWidthTop(PdfConstants.RAHMEN_DUENN);
    }
    if (BoxUtils.isLastColumnInRow(spalte, getSudokuSize())) {
        cell.setBorderWidthRight(PdfConstants.RAHMEN_DICK);
    } else {
        cell.setBorderWidthRight(PdfConstants.RAHMEN_DUENN);
    }
    if (BoxUtils.isLastRowInColumn(zeile, getSudokuSize())) {
        cell.setBorderWidthBottom(PdfConstants.RAHMEN_DICK);
    } else {
        cell.setBorderWidthBottom(PdfConstants.RAHMEN_DUENN);
    }
    if (BoxUtils.isFirstColumnInBlock(spalte, getSudokuSize())) {
        cell.setBorderWidthLeft(PdfConstants.RAHMEN_DICK);
    } else {
        cell.setBorderWidthLeft(PdfConstants.RAHMEN_DUENN);
    }
    cell.setFixedHeight(27f);
}

From source file:fr.opensagres.odfdom.converter.pdf.internal.stylable.StyleUtils.java

License:Open Source License

public static void applyStyles(StyleBorder border, PdfPCell cell) {
    if (border == null) {
        return;//  w  ww  .ja va 2  s .  c  o  m
    }
    switch (border.getBorderType()) {
    case ALL:
        // border
        if (border.isNoBorder()) {
            cell.disableBorderSide(PdfPCell.TOP);
            cell.disableBorderSide(PdfPCell.BOTTOM);
            cell.disableBorderSide(PdfPCell.RIGHT);
            cell.disableBorderSide(PdfPCell.LEFT);
        } else {
            cell.enableBorderSide(PdfPCell.TOP);
            cell.enableBorderSide(PdfPCell.BOTTOM);
            cell.enableBorderSide(PdfPCell.RIGHT);
            cell.enableBorderSide(PdfPCell.LEFT);
            // border-color
            Color color = border.getColor();
            if (color != null) {
                cell.setBorderColor(color);
            }
            // border-width
            Float width = border.getWidth();
            if (width != null) {
                cell.setBorderWidth(width);
            }
        }
        break;
    case BOTTOM:
        // border-bottom
        if (border.isNoBorder()) {
            cell.disableBorderSide(PdfPCell.BOTTOM);
        } else {
            cell.enableBorderSide(PdfPCell.BOTTOM);
            // border-bottom-color
            Color color = border.getColor();
            if (color != null) {
                cell.setBorderColorBottom(color);
            }
            // border-bottom-width
            Float width = border.getWidth();
            if (width != null) {
                cell.setBorderWidthBottom(width);
            }
        }
        break;
    case LEFT:
        // border-left
        if (border.isNoBorder()) {
            cell.disableBorderSide(PdfPCell.LEFT);
        } else {
            cell.enableBorderSide(PdfPCell.LEFT);
            // border-left-color
            Color color = border.getColor();
            if (color != null) {
                cell.setBorderColorLeft(color);
            }
            // border-left-width
            Float width = border.getWidth();
            if (width != null) {
                cell.setBorderWidthLeft(width);
            }
        }
        break;
    case RIGHT:
        // border-right
        if (border.isNoBorder()) {
            cell.disableBorderSide(PdfPCell.RIGHT);
        } else {
            cell.enableBorderSide(PdfPCell.RIGHT);
            // border-right-color
            Color color = border.getColor();
            if (color != null) {
                cell.setBorderColorRight(color);
            }
            // border-right-width
            Float width = border.getWidth();
            if (width != null) {
                cell.setBorderWidthRight(width);
            }
        }
        break;
    case TOP:
        // border-top
        if (border.isNoBorder()) {
            cell.disableBorderSide(PdfPCell.TOP);
        } else {
            cell.enableBorderSide(PdfPCell.TOP);
            // border-top-color
            Color color = border.getColor();
            if (color != null) {
                cell.setBorderColorTop(color);
            }
            // border-top-width
            Float width = border.getWidth();
            if (width != null) {
                cell.setBorderWidthTop(width);
            }
        }
        break;
    }

}

From source file:it.eng.spagobi.engines.documentcomposition.exporterUtils.PdfCreator.java

License:Mozilla Public License

public FileOutputStream createPdfFile(FileOutputStream fileOutputStream,
        Map<String, DocumentContainer> documentsMap, boolean defaultStyle)
        throws MalformedURLException, IOException, DocumentException {

    logger.debug("IN");

    Document document = new Document(PageSize.A4.rotate());
    Rectangle rect = document.getPageSize();
    docWidth = rect.getWidth();/*from   w  w w .j  ava2s.co  m*/
    docHeight = rect.getHeight();

    logger.debug("document size width: " + docWidth + " height: " + docHeight);

    //PdfWriter writer=PdfWriter.getInstance(document,new FileOutputStream("C:/comp/SpagoBIProva.pdf"));
    PdfWriter writer = PdfWriter.getInstance(document, fileOutputStream);
    document.open();

    int documentsNumber = documentsMap.keySet().size();
    int columnnsNumber = 2;

    if (defaultStyle == true) {
        logger.debug("use default style");
        int cellsCounter = 0;

        PdfPTable table = new PdfPTable(columnnsNumber);
        table.setWidthPercentage(100);

        for (Iterator iterator = documentsMap.keySet().iterator(); iterator.hasNext();) {
            String label = (String) iterator.next();
            DocumentContainer docContainer = documentsMap.get(label);
            byte[] content = docContainer.getContent();
            if (content != null) {
                Image img = null;
                try {
                    img = Image.getInstance(content);
                    table.addCell(img);
                } catch (Exception e) {
                    logger.debug("Trying to evaluate response as a PDF file... ");
                    table.addCell("");
                    //                  try {
                    //                     PdfReader reader = new PdfReader(content);
                    //                     PdfImportedPage page = writer.getImportedPage(reader, 1);
                    //                     writer.addPage(page);
                    //                     table.addCell("");
                    //                  } catch (Exception x) {
                    //                     logger.error("Error in inserting image for document " + label, e);
                    //                     logger.error("Error in inserting pdf file for document " + label, x);
                    //                     table.addCell("");
                    //                  }
                }
            }
            cellsCounter++;
        }

        // if cell counter is not pair make it pair
        if (cellsCounter % 2 != 0) {
            table.addCell("");
        }
        document.add(table);

    } else { // ************* NO DEFAULT STYLE *****************
        logger.debug("No default style");

        // I want to calculate total height of scaled heights!!
        //int totalScaledHeight=calculateTotaleScaledHeights(documentsMap, defaultStyle);

        // run on all documents
        for (Iterator iterator = documentsMap.keySet().iterator(); iterator.hasNext();) {
            String label = (String) iterator.next();
            logger.debug("document with label " + label);

            DocumentContainer docContainer = documentsMap.get(label);
            MetadataStyle style = docContainer.getStyle();

            // one table for each image, set at absolute position
            PdfPTable table = new PdfPTable(1);

            // width and height specified for the container by style attribute
            int widthStyle = style.getWidth();
            int heightStyle = style.getHeight();
            logger.debug("style for document width: " + widthStyle + " height: " + heightStyle);

            // width and height for the table scaled to the document size
            int tableWidth = calculatePxSize(docWidth, widthStyle, videoWidth);
            int tableHeight = calculatePxSize(docHeight, heightStyle, videoHeight);

            logger.debug("table for document width: " + tableWidth + " height: " + tableHeight);

            // x and y position as specified for the container by the style attribute
            int yStyle = style.getY();
            int xStyle = style.getX();
            // width and height scaled to the document size
            int xPos = (calculatePxPos(docWidth, xStyle, videoWidth));
            int yPos = (int) docHeight - (calculatePxPos(docHeight, yStyle, videoHeight));
            logger.debug("Table position at x: " + xPos + " y: " + yPos);

            // get the image
            byte[] content = docContainer.getContent();
            if (content != null) {
                Image img = null;
                try {
                    img = Image.getInstance(content);
                } catch (Exception e) {
                    logger.debug("Trying to evaluate response as a PDF file... ");
                    try {
                        PdfReader reader = new PdfReader(content);
                        PdfContentByte cb = writer.getDirectContent();
                        PdfImportedPage page = writer.getImportedPage(reader, 1);
                        float[] tm = getTransformationMatrix(page, xPos, yPos, tableWidth, tableHeight);
                        cb.addTemplate(page, tm[0], tm[1], tm[2], tm[3], tm[4], tm[5]);
                    } catch (Exception x) {
                        logger.error("Error in inserting image for document " + label, e);
                        logger.error("Error in inserting pdf file for document " + label, x);
                    }
                    continue;
                }

                //if it is a REPORT and has more than one page, too large, you have to resize the image, but how to understand it?
                // if image size is more than double of the container size cut the first part,otherwise scale it
                if (docContainer.getDocumentType().equals("REPORT")) {
                    boolean cutImageWIdth = isToCutWidth(img, tableWidth);
                    boolean cutImageHeight = isToCutHeight(img, tableWidth);

                    if (cutImageWIdth == true || cutImageHeight == true) {
                        logger.debug(
                                "Report will be cut to width " + tableWidth + " and height " + tableHeight);
                        try {
                            img = cutImage(content, cutImageHeight, cutImageWIdth, tableHeight, tableWidth,
                                    (int) img.getWidth(), (int) img.getHeight());
                        } catch (Exception e) {
                            logger.error(
                                    "Error in image cut, cutt will be ignored and image will be drawn anyway ",
                                    e);
                        }
                    }
                }

                // this is percentage to resize
                // The image must be size within the cell               
                int percToResize = percentageToResize((int) img.getWidth(), (int) img.getHeight(), tableWidth,
                        tableHeight);
                logger.debug("image will be scaled of percentage " + percToResize);
                img.scalePercent(percToResize);

                PdfPCell cell = new PdfPCell(img);
                cell.setNoWrap(true);
                cell.setFixedHeight(tableHeight);
                cell.setBorderWidth(0);
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setVerticalAlignment(Element.ALIGN_CENTER);
                table.addCell(cell);

                //table.setWidthPercentage(tableWidthPerc);
                table.setTotalWidth(tableWidth);
                table.setLockedWidth(true);
            } else {
                // TODO: setALT!
            }
            logger.debug("Add table");
            table.writeSelectedRows(0, -1, xPos, yPos, writer.getDirectContent());
            logger.debug("Document added");
        }

    }
    document.close();
    logger.debug("OUT");
    return fileOutputStream;
}

From source file:jdbreport.model.io.pdf.itext2.PdfWriter.java

License:Apache License

private void assignBorders(CellStyle style, PdfPCell pdfCell) {
    pdfCell.setBorderWidth(0);
    if (pdfCell.getBackgroundColor() != Color.WHITE) {
        pdfCell.setBorderColor(pdfCell.getBackgroundColor());
    }/*from ww w  .  ja  v  a 2 s.c o m*/
    Border border = style.getBorders(Border.LINE_LEFT);
    if (border != null) {
        pdfCell.setBorderWidthLeft(border.getLineWidth());
        pdfCell.setBorderColorLeft(border.getColor());
    }
    border = style.getBorders(Border.LINE_RIGHT);
    if (border != null) {
        pdfCell.setBorderWidthRight(border.getLineWidth());
        pdfCell.setBorderColorRight(border.getColor());
    }
    if (pdfCell.getBackgroundColor() != Color.WHITE) {
        pdfCell.setBorderWidthRight(0.5f);
    }
    border = style.getBorders(Border.LINE_TOP);
    if (border != null) {
        pdfCell.setBorderWidthTop(border.getLineWidth());
        pdfCell.setBorderColorTop(border.getColor());
    }
    border = style.getBorders(Border.LINE_BOTTOM);
    if (border != null) {
        pdfCell.setBorderWidthBottom(border.getLineWidth());
        pdfCell.setBorderColorBottom(border.getColor());
    }
    if (pdfCell.getBackgroundColor() != Color.WHITE) {
        pdfCell.setBorderWidthBottom(0.5f);
    }
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setCeldaPDF(String texto, int tipo, int tamanio, int estilo, int alineacion, int borde) {
    PdfPCell celda = new PdfPCell(new Paragraph(texto, new Font(tipo, tamanio, estilo)));
    celda.setHorizontalAlignment(alineacion);
    celda.setVerticalAlignment(Element.ALIGN_TOP);
    celda.setBorderColor(Color.LIGHT_GRAY);
    celda.setBorderWidth(borde);
    return celda;
}