Package com.itextpdf.text

Examples of com.itextpdf.text.Paragraph


    catch (Exception e)
    {
      Logger.error("unable to add hibiscus icon, will be ignored", e);
    }

    Paragraph pTitle = new Paragraph(title, FontFactory.getFont(FontFactory.HELVETICA_BOLD, 13));
    pTitle.setAlignment(Element.ALIGN_CENTER);
    rpt.add(pTitle);

    Paragraph psubTitle = new Paragraph(subtitle, FontFactory.getFont(FontFactory.HELVETICA_BOLD, 10));
    psubTitle.setAlignment(Element.ALIGN_CENTER);
    rpt.add(psubTitle);
  }
View Full Code Here


        return amount;
    }

    protected void writeEmptyLine() throws DocumentException{
        if (this.document!=null){
            this.document.add(new Paragraph(" "));
        }
    }
View Full Code Here

        }

        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);
View Full Code Here

            // PUT HEADERS

            if (this.reportSettingsProperties.loadUseAge()) {
                Chunk a = new Chunk("Edad");
                a.setFont(title);
                PdfPCell ages = new PdfPCell(new Paragraph(a));
                ages.setHorizontalAlignment(Element.ALIGN_CENTER);
                ages.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(ages);
            }

            if (this.reportSettingsProperties.loadUseWeight()) {
                Chunk p = new Chunk("Peso" + System.getProperty("line.separator") + Units.kilograms);
                p.setFont(title);
                PdfPCell weight = new PdfPCell(new Paragraph(p));
                weight.setHorizontalAlignment(Element.ALIGN_CENTER);
                weight.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(weight);
            }

            if (this.reportSettingsProperties.loadUseHeight()) {
                Chunk h = new Chunk("Altura" + System.getProperty("line.separator") + Units.Centimetres);
                h.setFont(title);
                PdfPCell height = new PdfPCell(new Paragraph(h));
                height.setHorizontalAlignment(Element.ALIGN_CENTER);
                height.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(height);
            }

            if (this.reportSettingsProperties.loadUsePS()) {
                Chunk pss = new Chunk("PS" + System.getProperty("line.separator") + Units.pressure);
                pss.setFont(title);
                PdfPCell ps = new PdfPCell(new Paragraph(pss));
                ps.setHorizontalAlignment(Element.ALIGN_CENTER);
                ps.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(ps);
            }

            if (this.reportSettingsProperties.loadUsePD()) {
                Chunk pdd = new Chunk("PD" + System.getProperty("line.separator") + Units.pressure);
                pdd.setFont(title);
                PdfPCell pd = new PdfPCell(new Paragraph(pdd));
                pd.setHorizontalAlignment(Element.ALIGN_CENTER);
                pd.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(pd);
            }

            if (this.reportSettingsProperties.loadUseSmoke()) {
                Chunk sm = new Chunk("Fuma");
                sm.setFont(title);
                PdfPCell smooke = new PdfPCell(new Paragraph(sm));
                smooke.setHorizontalAlignment(Element.ALIGN_CENTER);
                smooke.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(smooke);
            }

            // PUT DATA

            if (this.reportSettingsProperties.loadUseAge()) {
                Chunk years = new Chunk(patient.getAge().toString());
                years.setFont(value);
                PdfPCell agesValue = new PdfPCell(new Paragraph(years));
                agesValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                agesValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(agesValue);
            }

            if (this.reportSettingsProperties.loadUseWeight()) {
                Chunk weightP = new Chunk(analysis.getClinicalInformation().getWeightAsString(false));
                weightP.setFont(value);
                PdfPCell weightValue = new PdfPCell(new Paragraph(weightP));
                weightValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                weightValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(weightValue);
            }

            if (this.reportSettingsProperties.loadUseHeight()) {
                Chunk heightP = new Chunk(analysis.getClinicalInformation().getHeightAsString(false));
                heightP.setFont(value);
                PdfPCell heightValue = new PdfPCell(new Paragraph(heightP));
                heightValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                heightValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(heightValue);
            }

            if (this.reportSettingsProperties.loadUsePS()) {
                Chunk psCk = new Chunk(analysis.getClinicalInformation().getSystolicPressureAsString(false));
                psCk.setFont(value);
                PdfPCell psValue = new PdfPCell(new Paragraph(psCk));
                psValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                psValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(psValue);
            }

            if (this.reportSettingsProperties.loadUsePD()) {
                Chunk pdCk = new Chunk(analysis.getClinicalInformation().getDiastolicPressureAsString(false));
                pdCk.setFont(value);
                PdfPCell pdValue = new PdfPCell(new Paragraph(pdCk));
                pdValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                pdValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(pdValue);
            }

            if (this.reportSettingsProperties.loadUseSmoke()) {
                Chunk smk = new Chunk(patient.getClinicalHistoryProxy().getIsSmoker());
                smk.setFont(value);
                PdfPCell smookeValue = new PdfPCell(new Paragraph(smk));
                smookeValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                smookeValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(smookeValue);
            }
            this.document.add(patientTable);
View Full Code Here

            // 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);
            }
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);
View Full Code Here

        if ((!iarEmpty) || (!aodEmpty) || (!aosEmpty)) {

            Chunk indice = new Chunk(EntityDescriptions.INDEXS + ":" + System.getProperty("line.separator"));
            indice.setFont(titleFont);
            this.document.add(indice);
            this.document.add(new Paragraph());

            int samples = 0;
            try {
                AverageByDecade averageByDecade = FacadeDB.getInstance().getAveragesBroker().getAverageByPatient(analysis.getPatient());
                if (averageByDecade != null) {
View Full Code Here

    progress.setValue((int)progressValue);
    // columns are: date, duration, rate, total, description
    final PdfPTable table = new PdfPTable(5);
    table.setWidthPercentage(100);
        table.setWidths(new int[] {30, 30, 30, 40, 150});
        table.addCell(new Paragraph("Date", getDefaultBoldFont()));
        table.addCell(new Paragraph("Duration (hr)", getDefaultBoldFont()));
        table.addCell(new Paragraph("Rate per Hour", getDefaultBoldFont()));
        table.addCell(new Paragraph("Total", getDefaultBoldFont()));
        table.addCell(new Paragraph("Description", getDefaultBoldFont()));
       
        final double increment = map.size() / 80d;
        double sumDuration=0;
        double sumTotal=0;
        for (final Date d : map.keySet()) {
          progressValue+=increment;
          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);
View Full Code Here

    document.addAuthor(Config.getFrom());
    document.addCreator(Config.getFrom());
  }
  private void addTitle(final Document document) throws DocumentException {
    progress.setValue(10);
    final Paragraph from = new Paragraph(Config.getFrom(),getDefaultFont());
    from.setAlignment(Paragraph.ALIGN_CENTER);
    from.add(new Chunk("\n"));
      from.add(new Chunk(new LineSeparator(1f, 100f, BaseColor.BLACK, Element.ALIGN_CENTER, 0)));
      from.add(new Chunk("\n\n"));
      document.add(from);
     
      final PdfPTable table = new PdfPTable(2);
      final Paragraph invoice = new Paragraph("Invoice No", getDefaultBoldFont());
      final Paragraph invoiceValue = new Paragraph(this.invoiceNumber, getDefaultFont());
      final Paragraph date = new Paragraph("Date", getDefaultBoldFont());
      final Paragraph dateValue = new Paragraph(Util.ReportDateFormat.format(new Date()), getDefaultFont());
      final Paragraph to = new Paragraph("To", getDefaultBoldFont());
      final Paragraph toValue = new Paragraph(Config.getTo(), getDefaultFont());
     
      // no border
      table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
      table.setWidths(new int[] {15, 100});
     
      table.addCell(invoice);
      table.addCell(invoiceValue);
     
      table.addCell(date);
      table.addCell(dateValue);
     
      table.addCell(to);
      table.addCell(toValue);
     
      table.setHorizontalAlignment(Element.ALIGN_LEFT);
    document.add(table);
    document.add(new Paragraph("\n", getDefaultFont()));
    final String titleStr = "Invoice ("+Util.ReportDateFormat.format(start)+" - "+Util.ReportDateFormat.format(end)+")";
    final Font f = getDefaultBoldFont();
    f.setSize(14);
    final Paragraph title = new Paragraph(titleStr, f);
    title.setAlignment(Element.ALIGN_CENTER);
    document.add(title);
    document.add(new Paragraph("\n", getDefaultFont()));
  }
View Full Code Here

    progress.setValue(80);
   
    if (Config.getNotes().isEmpty()) return;
   
    final PdfPTable table = new PdfPTable(2);
      final Paragraph note = new Paragraph("Notes", getDefaultBoldFont());
      final Paragraph noteValue = new Paragraph(Config.getNotes(), getDefaultFont());
     
      // no border
      table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
      table.setWidths(new int[] {15, 100});
     
      table.addCell(note);
      table.addCell(noteValue);
     
      table.setHorizontalAlignment(Element.ALIGN_LEFT);
      document.add(new Paragraph("\n"));
      document.add(new LineSeparator(1f, 100f, BaseColor.BLACK, Element.ALIGN_CENTER, 0));
    document.add(table);
    document.add(new Paragraph("\n", getDefaultFont()));
  }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.Paragraph

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.