Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfPCell


            // PUT HEADER

            if (this.reportSettingsProperties.loadUseAOD()) {
                Chunk amp = new Chunk("Amplitud OD" + System.getProperty("line.separator") + Units.amplitude);
                amp.setFont(indexFont);
                PdfPCell amplitud = new PdfPCell(new Paragraph(amp));
                amplitud.setHorizontalAlignment(Element.ALIGN_CENTER);
                amplitud.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(amplitud);
            }

            if (this.reportSettingsProperties.loadUseIAR()) {
                Chunk aume = new Chunk("Aumentación" + System.getProperty("line.separator") + Units.amplitude);
                aume.setFont(indexFont);
                PdfPCell aumentacion = new PdfPCell(new Paragraph(aume));
                aumentacion.setHorizontalAlignment(Element.ALIGN_CENTER);
                aumentacion.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(aumentacion);
            }

            if (this.reportSettingsProperties.loadUseAOS()) {
                Chunk an = new Chunk("Ancho 50% OS" + System.getProperty("line.separator") + Units.miliseconds);
                an.setFont(indexFont);
                PdfPCell ancho = new PdfPCell(new Paragraph(an));
                ancho.setHorizontalAlignment(Element.ALIGN_CENTER);
                ancho.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(ancho);
            }

            if (this.reportSettingsProperties.loadUseIMC()) {
                Chunk m = new Chunk("Masa Corporal");
                m.setFont(indexFont);
                PdfPCell masa = new PdfPCell(new Paragraph(m));
                masa.setHorizontalAlignment(Element.ALIGN_CENTER);
                masa.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(masa);
            }

            if (this.reportSettingsProperties.loadUseFC()) {
                Chunk f = new Chunk("Frecuencia Card." + System.getProperty("line.separator") + "[ppm]");
                f.setFont(indexFont);
                PdfPCell freq = new PdfPCell(new Paragraph(f));
                freq.setHorizontalAlignment(Element.ALIGN_CENTER);
                freq.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(freq);
            }

            if (this.reportSettingsProperties.loadUseRS()) {
                Chunk r = new Chunk("Reflejo Sist." + System.getProperty("line.separator") + Units.miliseconds);
                r.setFont(indexFont);
                PdfPCell rs = new PdfPCell(new Paragraph(r));
                rs.setHorizontalAlignment(Element.ALIGN_CENTER);
                rs.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(rs);
            }

            if (this.reportSettingsProperties.loadUseAOD()) {
                Chunk ampCk = new Chunk(analysisResult.getAod().getValueAsString());
                ampCk.setFont(indexValueFont);
                PdfPCell ampValue = new PdfPCell(new Paragraph(ampCk));
                ampValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                ampValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(ampValue);
            }

            if (this.reportSettingsProperties.loadUseIAR()) {
                Chunk aumCk = new Chunk(analysisResult.getIar().getValueAsString());
                aumCk.setFont(indexValueFont);
                PdfPCell aum = new PdfPCell(new Paragraph(aumCk));
                aum.setHorizontalAlignment(Element.ALIGN_CENTER);
                aum.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(aum);
            }

            if (this.reportSettingsProperties.loadUseAOS()) {
                Chunk anchCk = new Chunk(analysisResult.getAos().getValueAsString());
                anchCk.setFont(indexValueFont);
                PdfPCell anch = new PdfPCell(new Paragraph(anchCk));
                anch.setHorizontalAlignment(Element.ALIGN_CENTER);
                anch.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(anch);
            }

            if (this.reportSettingsProperties.loadUseIMC()) {
                Chunk masCk = new Chunk(analysis.getClinicalInformation().getIMCasString());
                masCk.setFont(indexValueFont);
                PdfPCell mas = new PdfPCell(new Paragraph(masCk));
                mas.setHorizontalAlignment(Element.ALIGN_CENTER);
                mas.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(mas);
            }

            if (this.reportSettingsProperties.loadUseFC()) {
                Chunk freqCk = new Chunk(analysisResult.getHeartRateAsString());
                freqCk.setFont(indexValueFont);
                PdfPCell freqC = new PdfPCell(new Paragraph(freqCk));
                freqC.setHorizontalAlignment(Element.ALIGN_CENTER);
                freqC.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(freqC);
            }

            if (this.reportSettingsProperties.loadUseRS()) {
                Chunk rs = new Chunk(analysisResult.getT().getValueAsString());
                rs.setFont(indexValueFont);
                PdfPCell rsC = new PdfPCell(new Paragraph(rs));
                rsC.setHorizontalAlignment(Element.ALIGN_CENTER);
                rsC.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(rsC);
            }

            this.document.add(indicesTable);
        }
View Full Code Here


            PdfPTable tablePlot = new PdfPTable(widithPlot);
            tablePlot.setWidthPercentage(70);
            tablePlot.setHorizontalAlignment(Element.ALIGN_CENTER);
            Chunk plot = new Chunk(this.reportSettingsProperties.loadPlotTitle());
            plot.setFont(new Font(fontMapper.awtToPdf(this.reportSettingsProperties.loadPlotFont())));
            PdfPCell plotTitle = new PdfPCell(new Paragraph(plot));

            plotTitle.setVerticalAlignment(Element.ALIGN_MIDDLE);
            plotTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
            tablePlot.addCell(plotTitle);

            Image imagePdf = Image.getInstance(image, null);
            PdfPCell plotCell = new PdfPCell(imagePdf);
            plotCell.setFixedHeight(image.getHeight() + 20);
            plotCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            plotCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            tablePlot.addCell(plotCell);

            this.document.add(tablePlot);
            this.writeEmptyLine();
        }
View Full Code Here

    protected void buildHeader() throws DocumentException, IOException, MalformedURLException {

        float[] widiths = {0.5f, 2f, 0.5f};
        PdfPTable table = new PdfPTable(widiths);
        table.setWidthPercentage(90);
        PdfPCell imageL = new PdfPCell();
        PdfPCell imageR = new PdfPCell();

        if (this.reportSettingsProperties.loadUseLeftImage()) {
            BufferedImage leftImg = ImageUtils.loadImage(ImageUtils.IMAGES_FOLDER + System.getProperty("file.separator") + ReportSettingsProperties.FILE_NAME_LEFT_IMAGE);
            if (leftImg != null) {
                Image leftPdfImage = Image.getInstance(leftImg, null);
                leftPdfImage = this.scaleImage(leftPdfImage, this.reportSettingsProperties.loadLeftImageSize());
                leftPdfImage.setAlignment(Image.ALIGN_MIDDLE);
                imageL.setImage(leftPdfImage);
                imageL.setHorizontalAlignment(Element.ALIGN_MIDDLE);
                imageL.setVerticalAlignment(Element.ALIGN_CENTER);
            }
        }

        if (this.reportSettingsProperties.loadUseRightImage()) {
            BufferedImage rightImg = ImageUtils.loadImage(ImageUtils.IMAGES_FOLDER + System.getProperty("file.separator") + ReportSettingsProperties.FILE_NAME_RIGHT_IMAGE);
            if (rightImg != null) {
                Image rightImage = Image.getInstance(rightImg, null);
                rightImage.setAlignment(Image.ALIGN_MIDDLE);
                imageR.setImage(rightImage);
                imageR.setHorizontalAlignment(Element.ALIGN_MIDDLE);
                imageR.setVerticalAlignment(Element.ALIGN_CENTER);
            }
        }

        table.addCell(imageL);
        Chunk par = new Chunk(this.reportSettingsProperties.loadTitle());
        par.setFont(new Font(this.fontMapper.awtToPdf(this.reportSettingsProperties.loadTitleFont())));
        Paragraph enc = new Paragraph(par);
        enc.setAlignment(Element.ALIGN_CENTER);
        PdfPCell cell = new PdfPCell();
        cell.addElement(enc);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(cell);
        table.addCell(imageR);
        this.document.add(table);
        this.writeEmptyLine();
    }
View Full Code Here

            addCell(cellWrapper);
        }
    }

    private void decorateAndAddCell(PDFCellWrapper pdfCellWrapper) {
        PdfPCell pdfPCell = pdfCellWrapper.getCell();
        decorateCell(pdfCellWrapper);
        table.addCell(pdfPCell);
    }
View Full Code Here

public class PDFCellWrapper {

    private PdfPCell cell;

    public PDFCellWrapper(org.openinvoice.ubl4j.core.common.text.pdf.common.PDFPhraseWrapper pdfPhraseWrapper) {
        this.cell = new PdfPCell(pdfPhraseWrapper.getPhrase());
        setBorder(PDFInvoiceRendererBeanFactory.getTableCellBorder());
    }
View Full Code Here

        this.cell = new PdfPCell(pdfPhraseWrapper.getPhrase());
        setBorder(PDFInvoiceRendererBeanFactory.getTableCellBorder());
    }

    public PDFCellWrapper(PDFChunkWrapper pdfChunkWrapper) {
        this.cell = new PdfPCell();
        this.cell.addElement(pdfChunkWrapper.getChunk());
        setBorder(PDFInvoiceRendererBeanFactory.getTableCellBorder());
    }
View Full Code Here

          progress.setValue((int)progressValue);
          if (skipEmptyRecords && map.get(d).isEmpty()) {
            continue;
          }
         
          final PdfPCell dateCell = new PdfPCell(new Paragraph(Util.ReportDateFormat.format(d), getDefaultFont()));
          dateCell.setHorizontalAlignment(Element.ALIGN_CENTER);
          if (!map.get(d).isEmpty()) {
            dateCell.setRowspan(map.get(d).size());
          }
          table.addCell(dateCell);
          double tempSumDuration=0;
          double tempSumTotal=0;
          for (final RecordEntity r : map.get(d)) {
            PdfPCell duration = new PdfPCell(new Paragraph(Util.DecimalFormat.format(r.getDuration()),getDefaultFont()));
            duration.setHorizontalAlignment(Element.ALIGN_RIGHT);
            PdfPCell rate = new PdfPCell(new Paragraph(Util.CurrencyFormat.format(r.getRate()),getDefaultFont()));
            rate.setHorizontalAlignment(Element.ALIGN_RIGHT);
            PdfPCell total = new PdfPCell(new Paragraph(Util.CurrencyFormat.format(r.getDuration()*r.getRate()),getDefaultFont()));
            total.setHorizontalAlignment(Element.ALIGN_RIGHT);
            PdfPCell desc = new PdfPCell(new Paragraph(r.getDescription(),getDefaultFont()));
            desc.setHorizontalAlignment(Element.ALIGN_LEFT);

            tempSumDuration+=r.getDuration();
            tempSumTotal+=(r.getDuration()*r.getRate());
           
            table.addCell(duration);
              table.addCell(rate);
              table.addCell(total);
              table.addCell(desc);
          }
         
          if (map.get(d).isEmpty()) {
              table.addCell(new Paragraph(""));
              table.addCell(new Paragraph(""));
              table.addCell(new Paragraph(""));
              table.addCell(new Paragraph(""));
          } else {
            PdfPCell totalText = new PdfPCell(new Paragraph("Sum",getDefaultBoldFont()));
            totalText.setHorizontalAlignment(Element.ALIGN_LEFT);
            PdfPCell duration = new PdfPCell(new Paragraph(Util.DecimalFormat.format(tempSumDuration),getDefaultBoldFont()));
            duration.setHorizontalAlignment(Element.ALIGN_RIGHT);
            PdfPCell rate = new PdfPCell(new Paragraph("",getDefaultBoldFont()));
            rate.setHorizontalAlignment(Element.ALIGN_RIGHT);
            PdfPCell total = new PdfPCell(new Paragraph(Util.CurrencyFormat.format(tempSumTotal),getDefaultBoldFont()));
            total.setHorizontalAlignment(Element.ALIGN_RIGHT);
            PdfPCell desc = new PdfPCell(new Paragraph("",getDefaultBoldFont()));
            desc.setHorizontalAlignment(Element.ALIGN_LEFT);

            table.addCell(totalText);
            table.addCell(duration);
              table.addCell(rate);
              table.addCell(total);
              table.addCell(desc);
           
              if (!d.equals(end)) {
                  PdfPCell separator = new PdfPCell(new Paragraph("\n\n", getDefaultFont()));
                  separator.setColspan(5);
                  table.addCell(separator);
              }
          }
          sumDuration+=tempSumDuration;
          sumTotal+=tempSumTotal;
         
        }
        // adds total
        PdfPCell totalText = new PdfPCell(new Paragraph("Total",getDefaultBoldFont()));
        totalText.setHorizontalAlignment(Element.ALIGN_LEFT);
        PdfPCell duration = new PdfPCell(new Paragraph(Util.DecimalFormat.format(sumDuration),getDefaultBoldFont()));
        duration.setHorizontalAlignment(Element.ALIGN_RIGHT);
        PdfPCell rate = new PdfPCell(new Paragraph("",getDefaultBoldFont()));
        rate.setHorizontalAlignment(Element.ALIGN_RIGHT);
        PdfPCell total = new PdfPCell(new Paragraph(Util.CurrencyFormat.format(sumTotal),getDefaultBoldFont()));
        total.setHorizontalAlignment(Element.ALIGN_RIGHT);
        PdfPCell desc = new PdfPCell(new Paragraph("",getDefaultBoldFont()));
        desc.setHorizontalAlignment(Element.ALIGN_LEFT);
       
        totalText.setBorder(Rectangle.NO_BORDER);
        duration.setBorder(Rectangle.NO_BORDER);
        rate.setBorder(Rectangle.NO_BORDER);
        total.setBorder(Rectangle.NO_BORDER);
        desc.setBorder(Rectangle.NO_BORDER);
       
        table.addCell(totalText);
        table.addCell(duration);
        table.addCell(rate);
        table.addCell(total);
View Full Code Here

        try {
            PdfWriter.getInstance(document,new FileOutputStream("Totaal.pdf"));
            document.open();
            PdfPTable pdfTable = new PdfPTable(table.getColumnCount());
            pdfTable.setLockedWidth(false);
            PdfPCell cell = new PdfPCell();
            Phrase phrase = null;
            cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
            cell.setBorderWidthLeft(1);
            for(int i=0;i<table.getColumnCount();i++)
            {
                phrase = new Phrase(table.getColumnName(i));
                cell = new PdfPCell(phrase);
                cell.setBackgroundColor(new BaseColor(220, 220, 220));
                pdfTable.addCell(cell);
            }
            for(int i=0;i<table.getRowCount();++i)
            {
                for(int j=0;j<table.getColumnCount();++j)
                {
                    phrase = new Phrase(String.valueOf(table.getValueAt(i, j)));
                    cell = new PdfPCell(phrase);
                    pdfTable.addCell(cell);
                }
            }
            pdfTable.addCell("Totaal");
            pdfTable.addCell("");
View Full Code Here

  private PdfPCell buildCell(String text) {
    return buildCell(text, Fonts.FONT_MAIN_TEXT);
  }
 
  private PdfPCell buildCell(String text, Font font) {
    PdfPCell cell = new PdfPCell();
    Phrase pText = new Phrase(text, font );
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell.addElement(pText);
    return cell;
  }
View Full Code Here

     * @param  tag    a cell tag
     * @param  chain  the hierarchy chain
     * @return the created PdfPCell
     */
  public PdfPCell createPdfPCell(final String tag, final ChainedProperties chain) {
    PdfPCell cell = new PdfPCell((Phrase)null);
        // colspan
    String value = chain.getProperty(HtmlTags.COLSPAN);
        if (value != null)
            cell.setColspan(Integer.parseInt(value));
        // rowspan
        value = chain.getProperty(HtmlTags.ROWSPAN);
        if (value != null)
            cell.setRowspan(Integer.parseInt(value));
        // horizontal alignment
        if (tag.equals(HtmlTags.TH))
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        value = chain.getProperty(HtmlTags.ALIGN);
        if (value != null) {
            cell.setHorizontalAlignment(HtmlUtilities.alignmentValue(value));
        }
        // vertical alignment
        value = chain.getProperty(HtmlTags.VALIGN);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        if (value != null) {
            cell.setVerticalAlignment(HtmlUtilities.alignmentValue(value));
        }
        // border
        value = chain.getProperty(HtmlTags.BORDER);
        float border = 0;
        if (value != null)
            border = Float.parseFloat(value);
        cell.setBorderWidth(border);
        // cellpadding
        value = chain.getProperty(HtmlTags.CELLPADDING);
        if (value != null)
            cell.setPadding(Float.parseFloat(value));
        cell.setUseDescender(true);
        // background color
        value = chain.getProperty(HtmlTags.BGCOLOR);
        cell.setBackgroundColor(HtmlUtilities.decodeColor(value));
        return cell;
  }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.PdfPCell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.