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

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

Introduction

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

Prototype

public void setBorderColor(Color borderColor) 

Source Link

Document

Sets the color of the border.

Usage

From source file:org.revager.export.ProtocolPDFExporter.java

License:Open Source License

/**
 * Write the findings to the protocol./* w  ww  . j  a  v  a2  s  .  com*/
 * 
 * @param protocol
 *            the protocol
 * @param attachExtRefs
 *            true if the external references should be part of the protocol
 * 
 * @throws ExportException
 *             If an error occurs while writing the findings to the protocol
 */
protected void writeFindings(Protocol protocol, boolean attachExtRefs) throws ExportException {
    try {
        /*
         * Define fonts
         */
        Font plainFontTitle = new Font(
                BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 9, Font.NORMAL,
                Color.WHITE);

        Font boldFontTitle = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 10,
                Font.NORMAL, Color.WHITE);

        Font plainFont = new Font(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED),
                10);

        Font boldFont = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 10);

        Font italicFont = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 10);

        Font boldItalicFont = new Font(
                BaseFont.createFont(BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 10);

        /*
         * Write findings
         */
        PdfPTable tableBase = new PdfPTable(1);
        tableBase.setWidthPercentage(100);
        tableBase.setSplitRows(false);
        tableBase.getDefaultCell().setBorderWidth(0);
        tableBase.getDefaultCell().setPadding(0);

        for (Finding f : protocol.getFindings()) {
            tableBase.addCell(createVerticalStrut(PDFTools.cmToPt(0.7f), 1));
            PdfPCell cellFinding = new PdfPCell();
            cellFinding.setBorderColor(Color.GRAY);
            cellFinding.setBorderWidth(0.5f);

            PdfPTable tableTitle = new PdfPTable(3);
            tableTitle.setWidthPercentage(100);

            /*
             * Print title of the finding
             */
            Phrase phraseTitle = new Phrase(translate("Finding") + " " + f.getId(), boldFontTitle);

            PdfPCell cellTitle = new PdfPCell(phraseTitle);
            cellTitle.setBackgroundColor(bgColorTitle);
            cellTitle.setBorderWidth(0);
            cellTitle.setPadding(padding);
            cellTitle.setPaddingBottom(padding * 1.5f);
            cellTitle.setHorizontalAlignment(Element.ALIGN_LEFT);

            tableTitle.addCell(cellTitle);

            /*
             * Print severity of the finding
             */
            Phrase phraseSeverity = new Phrase(findMgmt.getLocalizedSeverity(f), plainFontTitle);

            PdfPCell cellSeverity = new PdfPCell(phraseSeverity);
            cellSeverity.setBackgroundColor(bgColorTitle);
            cellSeverity.setBorderWidth(0);
            cellSeverity.setPadding(padding);
            cellSeverity.setPaddingTop(padding * 1.1f);
            cellSeverity.setHorizontalAlignment(Element.ALIGN_CENTER);

            tableTitle.addCell(cellSeverity);

            /*
             * Print the meeting date and time of the finding
             */
            String meetingDate = sdfDate.format(protocol.getDate().getTime());

            PdfPCell cellMeeting = new PdfPCell(new Phrase(meetingDate, plainFontTitle));
            cellMeeting.setBackgroundColor(bgColorTitle);
            cellMeeting.setBorderWidth(0);
            cellMeeting.setPadding(padding);
            cellMeeting.setPaddingTop(padding * 1.1f);
            cellMeeting.setHorizontalAlignment(Element.ALIGN_RIGHT);

            tableTitle.addCell(cellMeeting);

            /*
             * Description
             */
            Phrase phraseDesc = new Phrase(f.getDescription(), plainFont);
            phraseDesc.setLeading(leading);

            PdfPCell cellDesc = new PdfPCell();
            cellDesc.addElement(phraseDesc);
            cellDesc.setBorderWidth(0);
            cellDesc.setPadding(padding);
            cellDesc.setColspan(3);

            tableTitle.addCell(cellDesc);

            cellFinding.addElement(tableTitle);

            /*
             * List point used for lists
             */
            Phrase phraseListPoint = new Phrase("", boldFont);
            phraseListPoint.setLeading(leading * 0.93f);

            PdfPCell cellListPoint = new PdfPCell();
            cellListPoint.addElement(phraseListPoint);
            cellListPoint.setBorderWidth(0);
            cellListPoint.setPadding(padding);
            cellListPoint.setPaddingLeft(padding * 2);

            /*
             * Table of references
             */
            if (f.getReferences().size() > 0
                    || (f.getExternalReferences().size() > 0 && attachExtRefs == true)) {
                PdfPTable tableRefs = new PdfPTable(new float[] { 0.04f, 0.96f });
                tableRefs.setWidthPercentage(100);

                PdfPCell cellRefTitle = new PdfPCell(new Phrase(translate("References:"), boldItalicFont));
                cellRefTitle.setBorderWidth(0);
                cellRefTitle.setPadding(padding);
                cellRefTitle.setPaddingTop(padding * 3);
                cellRefTitle.setPaddingBottom(0);
                cellRefTitle.setColspan(2);

                tableRefs.addCell(cellRefTitle);

                /*
                 * Textual references
                 */
                for (String ref : f.getReferences()) {
                    Phrase phraseRef = new Phrase(ref, plainFont);
                    phraseRef.setLeading(leading);

                    PdfPCell cellRef = new PdfPCell();
                    cellRef.addElement(phraseRef);
                    cellRef.setBorderWidth(0);
                    cellRef.setPadding(padding);

                    tableRefs.addCell(cellListPoint);

                    tableRefs.addCell(cellRef);
                }

                /*
                 * External file references
                 */
                if (attachExtRefs == true) {
                    for (File ref : findMgmt.getExtReferences(f)) {
                        Phrase phraseRef = new Phrase();
                        phraseRef.add(new Chunk(ref.getName(), plainFont));
                        phraseRef.add(new Chunk(" (" + translate("File Attachment") + ")", italicFont));
                        phraseRef.setFont(plainFont);
                        phraseRef.setLeading(leading);

                        PdfPCell cellRef = new PdfPCell();
                        cellRef.addElement(phraseRef);
                        cellRef.setBorderWidth(0);
                        cellRef.setPadding(padding);

                        tableRefs.addCell(cellListPoint);

                        cellRef.setCellEvent(new PDFCellEventExtRef(pdfWriter, ref));

                        tableRefs.addCell(cellRef);
                    }
                }

                cellFinding.addElement(tableRefs);
            }

            /*
             * Table of aspects
             */
            if (f.getAspects().size() > 0) {
                PdfPTable tableAspects = new PdfPTable(new float[] { 0.04f, 0.96f });
                tableAspects.setWidthPercentage(100);

                PdfPCell cellAspTitle = new PdfPCell(new Phrase(translate("Aspects:"), boldItalicFont));
                cellAspTitle.setBorderWidth(0);
                cellAspTitle.setPadding(padding);
                cellAspTitle.setPaddingTop(padding * 3);
                cellAspTitle.setPaddingBottom(0);
                cellAspTitle.setColspan(2);

                tableAspects.addCell(cellAspTitle);

                for (String asp : f.getAspects()) {
                    Phrase phraseAsp = new Phrase(asp, plainFont);
                    phraseAsp.setLeading(leading);

                    PdfPCell cellAsp = new PdfPCell();
                    cellAsp.addElement(phraseAsp);
                    cellAsp.setBorderWidth(0);
                    cellAsp.setPadding(padding);

                    tableAspects.addCell(cellListPoint);

                    tableAspects.addCell(cellAsp);
                }

                cellFinding.addElement(tableAspects);
            }

            /*
             * Vertical strut at the end of the table
             */
            PdfPTable tableStrut = new PdfPTable(1);
            tableStrut.setWidthPercentage(100);
            tableStrut.addCell(createVerticalStrut(padding, 1));

            cellFinding.addElement(tableStrut);

            tableBase.addCell(cellFinding);
        }

        pdfDoc.add(tableBase);
    } catch (Exception e) {
        /*
         * Not part of unit testing because this exception is only thrown if
         * an internal error occurs.
         */
        throw new ExportException(translate("Cannot put findings into the PDF document."));
    }
}

From source file:org.tellervo.desktop.print.BasicBoxLabel.java

License:Open Source License

public void generateBoxLabel(OutputStream output) {

    try {//from w  w w . java2 s  . c  om

        PdfWriter writer = PdfWriter.getInstance(document, output);

        document.setPageSize(PageSize.LETTER);

        document.open();

        cb = writer.getDirectContent();

        // Set basic metadata
        document.addAuthor("Tellervo");
        document.addSubject("Tellervo Box Labels");

        PdfPTable table = new PdfPTable(2);
        table.setTotalWidth(495f);
        table.setLockedWidth(true);

        for (WSIBox b : boxlist) {
            Paragraph p = new Paragraph();

            p.add(new Chunk(b.getTitle() + Chunk.NEWLINE, labelTitleFont));
            p.add(new Chunk(Chunk.NEWLINE + b.getComments() + Chunk.NEWLINE, bodyFont));
            p.add(new Chunk(App.getLabName() + Chunk.NEWLINE + Chunk.NEWLINE, bodyFont));
            p.add(new Chunk(this.getBarCode(b), 0, 0, true));

            PdfPCell cell = new PdfPCell(p);
            cell.setPaddingLeft(15f);
            cell.setPaddingRight(15f);
            cell.setBorderColor(Color.LIGHT_GRAY);

            table.addCell(cell);

        }

        PdfPCell cell = new PdfPCell(new Paragraph());
        cell.setBorderColor(Color.LIGHT_GRAY);

        table.addCell(cell);
        document.add(table);
        document.close();

        /*float top = document.top(15);
        int row = 1;
                
        for(int i = 0; i< boxlist.size(); i = i+2)
        {
                   
           log.debug("Document left : "+document.left());
           log.debug("Document right: "+document.right());
           log.debug("Top           : "+top);
                   
                   
                   
                   
                   
                   
          // Column 1      
          ColumnText ct1a = new ColumnText(cb);
          ct1a.setSimpleColumn(document.left(), 
                   top-210, 
                   368, 
                   top, 
                   20, 
                   Element.ALIGN_LEFT);
                  
          ColumnText ct1b = new ColumnText(cb);
          ct1b.setSimpleColumn(document.left(), 
             top-70, 
             document.left()+206, 
             top-150, 
             20, 
             Element.ALIGN_LEFT);
                  
          try{
        WSIBox b1 = boxlist.get(i);
        ct1a.addText(getTitlePDF(b1));
        ct1a.go();
                     
                
        ct1b.addElement(getBarCode(b1));
        ct1b.go();
                
          } catch (Exception e)
          {
             log.debug("Failed writing box label in left column where i="+i);
          }
                  
                  
          // Column 2      
          ColumnText ct2a = new ColumnText(cb);
          ct2a.setSimpleColumn(306, 
                   top-210, 
                   document.right(), 
                   top, 
                   20, 
                   Element.ALIGN_LEFT);
                  
          ColumnText ct2b = new ColumnText(cb);
          ct2b.setSimpleColumn(306, 
             top-70, 
             512,  
             top-80, 
             20, 
             Element.ALIGN_LEFT);
                  
          try{
        WSIBox b2 = boxlist.get(i+1);
        ct2a.addText(getTitlePDF(b2));
        ct2a.go();
                     
                
        ct2b.addElement(getBarCode(b2));
        ct2b.go();
                
          } catch (Exception e)
          {
             log.debug("Failed writing box label in right column where i="+i);
             //e.printStackTrace();
          }
                  
                  
          // Column 2
        /*   ColumnText ct2 = new ColumnText(cb);
          ct2.setSimpleColumn(370,     //llx 
          top-100,            //lly   
          document.right(0),   //urx
          top+15,            //ury
          20,               //leading
          Element.ALIGN_RIGHT  //alignment
          );
                  
          try{
          WSIBox b2 = boxlist.get(i+1);
          ct2.addText(getTitlePDF(b2));
          ct2.addElement(getBarCode(b2));
          ct2.go();
          } catch (Exception e)
          {
             log.debug("Failed writing box label where i="+i+1);
          }
          */
        /*
                
        top = top-160;
                
        if(row==5)
        {
           top = document.top(15);
        document.newPage();
        row=1;
        }
        else
        {
           row++;
        }
                
                
                
                
                
        }*/

    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    }

    // Close the document
    document.close();
}

From source file:org.unitime.timetable.webutil.pdf.PdfEventTableBuilder.java

License:Open Source License

public PdfPCell createCell() {
    PdfPCell cell = new PdfPCell();
    cell.setBorderColor(Color.BLACK);
    cell.setPadding(3);//from   w ww .  jav a 2  s . c o m
    cell.setBorderWidth(0);
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(iBgColor);
    if (iUnderline)
        cell.setBorderWidthBottom(1);
    if (iOverline)
        cell.setBorderWidthTop(0.5f);
    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

public PdfPCell createCell() {
    PdfPCell cell = new PdfPCell();
    cell.setBorderColor(sBorderColor);
    cell.setPadding(3);/* w  ww . j a  v a  2 s  .co  m*/
    cell.setBorderWidth(0);
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(iBgColor);
    return cell;
}

From source file:org.unitime.timetable.webutil.PdfWebTable.java

License:Open Source License

private PdfPCell createCell() {
    PdfPCell cell = new PdfPCell();
    cell.setBorderColor(Color.BLACK);
    cell.setPadding(3);/*  ww w.  j av  a 2 s .co  m*/
    cell.setBorderWidth(0);
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    return cell;
}

From source file:org.unitime.timetable.webutil.PdfWebTable.java

License:Open Source License

private float addText(PdfPCell cell, String text, boolean bold, boolean italic, boolean underline, Color color,
        boolean border, Color borderColor, Color bgColor) {

    if (border) {
        cell.setBorderWidth(1);//from w w w.j av a2  s .co  m
        cell.setBorder(PdfPCell.RIGHT | PdfPCell.LEFT | PdfPCell.TOP | PdfPCell.BOTTOM);
        if (borderColor == null)
            cell.setBorderColor(Color.BLACK);
        else
            cell.setBorderColor(borderColor);
    }

    return addText(cell, text, bold, italic, underline, color, bgColor);
}

From source file:org.unitime.timetable.webutil.timegrid.PdfExamGridTable.java

License:Open Source License

public PdfPCell createCell() {
    PdfPCell cell = new PdfPCell();
    cell.setBorderColor(sBorderColor);
    cell.setPadding(3);//from  www.  j a  va  2s.c o  m
    cell.setBorderWidth(0);
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorderWidthTop(1);
    cell.setBorderWidthBottom(1);
    cell.setBorderWidthLeft(1);
    cell.setBorderWidthRight(1);
    return cell;
}

From source file:org.unitime.timetable.webutil.timegrid.PdfExamGridTable.java

License:Open Source License

public PdfPCell createCellNoBorder() {
    PdfPCell cell = new PdfPCell();
    cell.setBorderColor(sBorderColor);
    cell.setPadding(3);//from w w  w.jav a  2  s.co m
    cell.setBorderWidth(0);
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    return cell;
}

From source file:oscar.oscarLab.ca.all.pageUtil.LabPDFCreator.java

License:Open Source License

private void addLabCategory(String header) throws DocumentException {

    float[] mainTableWidths = { 5f, 3f, 1f, 3f, 2f, 4f, 2f };
    PdfPTable table = new PdfPTable(mainTableWidths);
    table.setHeaderRows(3);//from w  w w.j a va  2 s  .  c  om
    table.setWidthPercentage(100);

    PdfPCell cell = new PdfPCell();
    // category name
    cell.setPadding(3);
    cell.setPhrase(new Phrase("  "));
    cell.setBorder(0);
    cell.setColspan(7);
    table.addCell(cell);
    cell.setBorder(15);
    cell.setPadding(3);
    cell.setColspan(2);
    cell.setPhrase(new Phrase(header.replaceAll("<br\\s*/*>", "\n"), new Font(bf, 12, Font.BOLD)));
    table.addCell(cell);
    cell.setPhrase(new Phrase("  "));
    cell.setBorder(0);
    cell.setColspan(5);
    table.addCell(cell);

    // table headers
    cell.setColspan(1);
    cell.setBorder(15);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(new Color(210, 212, 255));
    cell.setPhrase(new Phrase("Test Name(s)", boldFont));
    table.addCell(cell);
    cell.setPhrase(new Phrase("Result", boldFont));
    table.addCell(cell);
    cell.setPhrase(new Phrase("Abn", boldFont));
    table.addCell(cell);
    cell.setPhrase(new Phrase("Reference Range", boldFont));
    table.addCell(cell);
    cell.setPhrase(new Phrase("Units", boldFont));
    table.addCell(cell);
    cell.setPhrase(new Phrase("Date/Time Completed", boldFont));
    table.addCell(cell);
    cell.setPhrase(new Phrase("Status", boldFont));
    table.addCell(cell);

    // add test results
    int obrCount = handler.getOBRCount();
    int linenum = 0;
    cell.setBorder(12);
    cell.setBorderColor(Color.BLACK); // cell.setBorderColor(Color.WHITE);
    cell.setBackgroundColor(new Color(255, 255, 255));

    if (handler.getMsgType().equals("MEDVUE")) {

        //cell.setBackgroundColor(getHighlightColor(linenum));
        linenum++;
        cell.setPhrase(new Phrase(handler.getRadiologistInfo(), boldFont));
        cell.setColspan(7);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(cell);
        cell.setPaddingLeft(100);
        cell.setColspan(7);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setPhrase(new Phrase(handler.getOBXComment(1, 1, 1).replaceAll("<br\\s*/*>", "\n"), font));
        table.addCell(cell);

    } else {
        for (int j = 0; j < obrCount; j++) {
            boolean obrFlag = false;
            int obxCount = handler.getOBXCount(j);
            for (int k = 0; k < obxCount; k++) {
                String obxName = handler.getOBXName(j, k);

                if (!handler.getOBXResultStatus(j, k).equals("TDIS")) {

                    // ensure that the result is a real result
                    if ((!handler.getOBXResultStatus(j, k).equals("DNS") && !obxName.equals("")
                            && handler.getObservationHeader(j, k).equals(header))
                            || (handler.getMsgType().equals("EPSILON")
                                    && handler.getOBXIdentifier(j, k).equals(header) && !obxName.equals(""))
                            || (handler.getMsgType().equals("PFHT") && !obxName.equals("")
                                    && handler.getObservationHeader(j, k).equals(header))) { // <<-- DNS only needed for
                        // MDS messages
                        String obrName = handler.getOBRName(j);

                        // add the obrname if necessary
                        if (!obrFlag && !obrName.equals("") && !(obxName.contains(obrName) && obxCount < 2)) {
                            // cell.setBackgroundColor(getHighlightColor(linenum));
                            linenum++;
                            cell.setPhrase(new Phrase(obrName, boldFont));
                            cell.setColspan(7);
                            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                            table.addCell(cell);
                            cell.setColspan(1);
                            obrFlag = true;
                        }

                        // add the obx results and info
                        Font lineFont = new Font(bf, 8, Font.NORMAL,
                                getTextColor(handler.getOBXAbnormalFlag(j, k)));
                        // cell.setBackgroundColor(getHighlightColor(linenum));
                        linenum++;
                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                        cell.setPhrase(new Phrase((obrFlag ? "   " : "") + obxName, lineFont));
                        table.addCell(cell);
                        cell.setPhrase(new Phrase(handler.getOBXResult(j, k).replaceAll("<br\\s*/*>", "\n"),
                                lineFont));
                        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
                        table.addCell(cell);
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setPhrase(new Phrase(
                                (handler.isOBXAbnormal(j, k) ? handler.getOBXAbnormalFlag(j, k) : "N"),
                                lineFont));
                        table.addCell(cell);
                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                        cell.setPhrase(new Phrase(handler.getOBXReferenceRange(j, k), lineFont));
                        table.addCell(cell);
                        cell.setPhrase(new Phrase(handler.getOBXUnits(j, k), lineFont));
                        table.addCell(cell);
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setPhrase(new Phrase(handler.getTimeStamp(j, k), lineFont));
                        table.addCell(cell);
                        cell.setPhrase(new Phrase(handler.getOBXResultStatus(j, k), lineFont));
                        table.addCell(cell);

                        if (!handler.getMsgType().equals("PFHT")) {
                            // add obx comments
                            if (handler.getOBXCommentCount(j, k) > 0) {
                                // cell.setBackgroundColor(getHighlightColor(linenum));
                                linenum++;
                                cell.setPaddingLeft(100);
                                cell.setColspan(7);
                                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                                for (int l = 0; l < handler.getOBXCommentCount(j, k); l++) {

                                    cell.setPhrase(new Phrase(
                                            handler.getOBXComment(j, k, l).replaceAll("<br\\s*/*>", "\n"),
                                            font));
                                    table.addCell(cell);

                                }
                                cell.setPadding(3);
                                cell.setColspan(1);
                            }
                        }
                        // if (DNS)
                    } else if ((handler.getMsgType().equals("EPSILON")
                            && handler.getOBXIdentifier(j, k).equals(header) && obxName.equals(""))
                            || (handler.getMsgType().equals("PFHT") && obxName.equals("")
                                    && handler.getObservationHeader(j, k).equals(header))) {
                        // cell.setBackgroundColor(getHighlightColor(linenum));
                        linenum++;
                        cell.setPaddingLeft(100);
                        cell.setColspan(7);
                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                        cell.setPhrase(
                                new Phrase(handler.getOBXResult(j, k).replaceAll("<br\\s*/*>", "\n"), font));
                        table.addCell(cell);
                        cell.setPadding(3);
                        cell.setColspan(1);

                    }
                    if (handler.getMsgType().equals("PFHT") && !handler.getNteForOBX(j, k).equals("")
                            && handler.getNteForOBX(j, k) != null) {
                        // cell.setBackgroundColor(getHighlightColor(linenum));
                        linenum++;
                        cell.setPaddingLeft(100);
                        cell.setColspan(7);
                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                        cell.setPhrase(
                                new Phrase(handler.getNteForOBX(j, k).replaceAll("<br\\s*/*>", "\n"), font));
                        table.addCell(cell);
                        cell.setPadding(3);
                        cell.setColspan(1);

                        if (handler.getOBXCommentCount(j, k) > 0) {
                            // cell.setBackgroundColor(getHighlightColor(linenum));
                            linenum++;
                            cell.setPaddingLeft(100);
                            cell.setColspan(7);
                            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                            for (int l = 0; l < handler.getOBXCommentCount(j, k); l++) {

                                cell.setPhrase(new Phrase(
                                        handler.getOBXComment(j, k, l).replaceAll("<br\\s*/*>", "\n"), font));
                                table.addCell(cell);

                            }
                            cell.setPadding(3);
                            cell.setColspan(1);
                        }
                    }
                } else {
                    if (handler.getOBXCommentCount(j, k) > 0) {
                        // cell.setBackgroundColor(getHighlightColor(linenum));
                        linenum++;
                        cell.setPaddingLeft(100);
                        cell.setColspan(7);
                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                        for (int l = 0; l < handler.getOBXCommentCount(j, k); l++) {

                            cell.setPhrase(new Phrase(
                                    handler.getOBXComment(j, k, l).replaceAll("<br\\s*/*>", "\n"), font));
                            table.addCell(cell);

                        }
                        cell.setPadding(3);
                        cell.setColspan(1);
                    }
                } // if (!handler.getOBXResultStatus(j, k).equals("TDIS"))

            }

            if (!handler.getMsgType().equals("PFHT")) {
                // add obr comments
                if (handler.getObservationHeader(j, 0).equals(header)) {
                    cell.setColspan(7);
                    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    for (int k = 0; k < handler.getOBRCommentCount(j); k++) {
                        // the obrName should only be set if it has not been
                        // set already which will only have occured if the
                        // obx name is "" or if it is the same as the obr name
                        if (!obrFlag && handler.getOBXName(j, 0).equals("")) {
                            // cell.setBackgroundColor(getHighlightColor(linenum));
                            linenum++;

                            cell.setPhrase(new Phrase(handler.getOBRName(j), boldFont));
                            table.addCell(cell);
                            obrFlag = true;
                        }

                        // cell.setBackgroundColor(getHighlightColor(linenum));
                        linenum++;
                        cell.setPaddingLeft(100);
                        cell.setPhrase(
                                new Phrase(handler.getOBRComment(j, k).replaceAll("<br\\s*/*>", "\n"), font));
                        table.addCell(cell);
                        cell.setPadding(3);
                    }
                    cell.setColspan(1);
                }
            }
        } // for (j)

    } // if (isMEDVUE)

    document.add(table);

}