Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfPTable


  }

  public String reporteFallasPDF() {
    try {

      PdfPTable tabla = null;
      Document document = new Document();

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      PdfWriter writer = PdfWriter.getInstance(document, baos);
      Map<String, Object> session = ActionContext.getContext().getSession();

      HeaderFooter event = new HeaderFooter((String)session.get("txtNegocio"));
      writer.setPageEvent(event);

      document.open();

      if (tipo.equals("0")) {// falla
        if (texto.trim().length() > 0) {
          fallaList = ReporteLNBO.reporteFallas(fechaini, fechater,
              texto, idEquipo);
        } else {
          fallaList = ReporteLNBO.reporteFallasSinTexto(fechaini,
              fechater, idEquipo);
        }
        Iterator<FallaLN> iteFallas = fallaList.iterator();
        String[] headers = new String[] { "Fecha", "Equipo", "Problema" };
        tabla = new PdfPTable(headers.length);
        tabla.setWidthPercentage(100);
       
        float[] widths = new float[] { 1f, 3f, 4f };
       
        tabla.setWidths(widths);
       
        for (int i = 0; i < headers.length; i++) {
          String header = headers[i];
          PdfPCell cell = new PdfPCell();
          cell.setGrayFill(0.9f);
          cell.setPhrase(new Phrase(header.toUpperCase(), new Font(
              FontFamily.HELVETICA, 10, Font.BOLD)));
          tabla.addCell(cell);
        }
        tabla.completeRow();

        while (iteFallas.hasNext()) {
          FallaLN falla = iteFallas.next();
          PdfPCell cell0 = new PdfPCell();
          PdfPCell cell1 = new PdfPCell();
          PdfPCell cell2 = new PdfPCell();

          SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
          String fecha = sdf.format(falla.getFecha());
          cell0.setPhrase(new Phrase(fecha, new Font(
              FontFamily.HELVETICA, 8, Font.NORMAL)));
          cell1.setPhrase(new Phrase(falla.getEquipoNombre(),
              new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          cell2.setPhrase(new Phrase(falla.getProblema(), new Font(
              FontFamily.HELVETICA, 8, Font.NORMAL)));
          tabla.addCell(cell0);
          tabla.addCell(cell1);
          tabla.addCell(cell2);
          tabla.completeRow();
        }
      } else if (tipo.equals("1")) {// novedad
        if (texto.trim().length() > 0) {
          novedadList = ReporteLNBO.reporteNovedades(fechaini,
              fechater, texto, idEquipo);
        } else {
          novedadList = ReporteLNBO.reporteNovedadesSinTexto(
              fechaini, fechater, idEquipo);
        }
        Iterator<BitacoraLN> iteNovedadesfallas = novedadList
            .iterator();
        String[] headers = new String[] { "Fecha", "Usuario", "Turno",
            "Equipo", "Novedad" };
        tabla = new PdfPTable(headers.length);
        tabla.setWidthPercentage(100);
       
       
        float[] widths = new float[] { 2f, 2f, 1f,2f, 5f };
       
        tabla.setWidths(widths);
       
        for (int i = 0; i < headers.length; i++) {
          String header = headers[i];
          PdfPCell cell = new PdfPCell();
          cell.setGrayFill(0.9f);
          cell.setPhrase(new Phrase(header.toUpperCase(), new Font(
              FontFamily.HELVETICA, 10, Font.BOLD)));
          tabla.addCell(cell);
        }
        tabla.completeRow();
        while (iteNovedadesfallas.hasNext()) {

          BitacoraLN bitacora = iteNovedadesfallas.next();
          PdfPCell cell0 = new PdfPCell();
          PdfPCell cell1 = new PdfPCell();
          PdfPCell cell2 = new PdfPCell();
          PdfPCell cell3 = new PdfPCell();
          PdfPCell cell4 = new PdfPCell();
          SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
          String fecha = sdf.format(bitacora.getFecha());
          cell0.setPhrase(new Phrase(fecha, new Font(
              FontFamily.HELVETICA, 8, Font.NORMAL)));
          if (bitacora.getUsuarioNombre() != null) {
            cell1.setPhrase(new Phrase(bitacora.getUsuarioNombre(),
                new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          } else {
            cell1.setPhrase(new Phrase("", new Font(
                FontFamily.HELVETICA, 8, Font.NORMAL)));
          }
          cell2.setPhrase(new Phrase(bitacora.getTurnoNombre(),
              new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          cell3.setPhrase(new Phrase(bitacora.getEquipoNombre(),
              new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          cell4.setPhrase(new Phrase(bitacora.getComentario().getValue(),
              new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          tabla.addCell(cell0);
          tabla.addCell(cell1);
          tabla.addCell(cell2);
          tabla.addCell(cell3);
          tabla.addCell(cell4);
          tabla.completeRow();
        }
      }

      document.add(tabla);
View Full Code Here


        Rectangle page = document.getPageSize();

        PdfPCell imageCell = null;
        PdfPCell textCell = null;

        PdfPTable head = new PdfPTable(2);
        float[] widths = new float[] { 1f, 4f };
        head.setWidths(widths);
        ServletContext context = getServletContext();
       
        String relativeWebPath = "/images/logo_melon.gif";
        String absoluteDiskPath = context.getRealPath(relativeWebPath);
        Image headImage = Image.getInstance(absoluteDiskPath);
        headImage.scaleToFit(75, 75);

        imageCell = new PdfPCell(headImage);
        imageCell.setBorder(Rectangle.NO_BORDER);
        head.addCell(imageCell);

        Font catFont = new Font(Font.FontFamily.HELVETICA, 16,
            Font.BOLD);
        textCell = new PdfPCell(new Phrase("Reporte de Novedades: "
            + negocio, catFont));
        textCell.setBorder(Rectangle.NO_BORDER);
        head.addCell(textCell);

        head.setTotalWidth(page.getWidth() - document.leftMargin()
            - document.rightMargin());

        head.writeSelectedRows(
            0,
            -1,
            document.leftMargin(),
            page.getHeight() - document.topMargin()
                + head.getTotalHeight(),
            writer.getDirectContent());
        document.add(new Paragraph("\n"));

      } catch (Exception de) {
        log.severe(de.getMessage());
View Full Code Here

                Rectangle page = document.getPageSize();

                PdfPCell imageCell = null;
                PdfPCell textCell = null;

                PdfPTable head = new PdfPTable(2);
                float[] widths = new float[] { 1f, 4f };
                head.setWidths(widths);

            ServletContext context = ServletActionContext.getServletContext();
        String relativeWebPath = "/images/logo_melon.gif";
        String absoluteDiskPath = context.getRealPath(relativeWebPath);
        Image headImage = Image.getInstance(absoluteDiskPath);
        headImage.scaleToFit(75, 75);
       
                imageCell = new PdfPCell(headImage);
                imageCell.setBorder(Rectangle.NO_BORDER);
                head.addCell(imageCell);

                Font catFont = new Font(Font.FontFamily.HELVETICA, 16,
                  Font.BOLD);
                textCell = new PdfPCell(new Phrase("Reporte de Novedades: " + negocio,catFont));
                textCell.setBorder(Rectangle.NO_BORDER);
                head.addCell(textCell);

                head.setTotalWidth(page.getWidth() - document.leftMargin()
                                - document.rightMargin());

                head.writeSelectedRows(0, -1, document.leftMargin(), page
                                .getHeight()
                                - document.topMargin() + head.getTotalHeight(), writer
                                .getDirectContent())
                document.add(new Paragraph("\n"));

            }
            catch(Exception de) {
View Full Code Here

     * @return  a PdfPTable
     */
    public PdfPTable createTable() {
      // no rows = simplest table possible
        if (rows.isEmpty())
            return new PdfPTable(1);
        // how many columns?
        int ncol = 0;
        for (PdfPCell pc : rows.get(0)) {
            ncol += pc.getColspan();
        }
        PdfPTable table = new PdfPTable(ncol);
        // table width
        String width = styles.get(HtmlTags.WIDTH);
        if (width == null)
            table.setWidthPercentage(100);
        else {
            if (width.endsWith("%"))
                table.setWidthPercentage(Float.parseFloat(width.substring(0, width.length() - 1)));
            else {
                table.setTotalWidth(Float.parseFloat(width));
                table.setLockedWidth(true);
            }
        }
        // horizontal alignment
        String alignment = styles.get(HtmlTags.ALIGN);
        int align = Element.ALIGN_LEFT;
        if (alignment != null) {
          align = HtmlUtilities.alignmentValue(alignment);
        }
        table.setHorizontalAlignment(align);
        // column widths
    try {
      if (colWidths != null)
        table.setWidths(colWidths);
    } catch (Exception e) {
      // fail silently
    }
    // add the cells
        for (List<PdfPCell> col : rows) {
            for (PdfPCell pc : col) {
                table.addCell(pc);
            }
        }
        return table;
    }
View Full Code Here

   * @throws DocumentException
   * @since 5.0.6
   */
  public void processTable() throws DocumentException{
    TableWrapper table = (TableWrapper) stack.pop();
    PdfPTable tb = table.createTable();
    tb.setSplitRows(true);
    if (stack.empty())
      document.add(tb);
    else
      ((TextElementArray) stack.peek()).add(tb);
  }
View Full Code Here

 
  @Override
  public void onStartPage(PdfWriter writer, Document document) {
        Rectangle page = document.getPageSize();
    float[] relSize = {7, 4};
    PdfPTable head = new PdfPTable(relSize);
    PdfPTable innerHead = new PdfPTable(1);
   
    //Image
    try {
      image = Image.getInstance(PDFHeaderFooterWriter.class.getResource("/images/logo.jpg"));
    } catch (BadElementException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    } catch (MalformedURLException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    } catch (IOException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    }
    image.scalePercent(35);
//    image.setAlignment(Image.RIGHT | Image.TEXTWRAP);//Code 2
    Paragraph paraImgHead = new Paragraph();
    paraImgHead.add(new Chunk(image, 0, 0));
    paraImgHead.add(new Phrase(""));
   
    PdfPCell tmp = new PdfPCell(innerHead);
    tmp.setBorder(Rectangle.NO_BORDER);
        tmp.setBorderWidth(0);
        tmp.setPadding(0);
        tmp.setUseBorderPadding(false);
        tmp.setHorizontalAlignment(Element.ALIGN_CENTER);
        head.addCell(tmp);
   
    tmp = new PdfPCell(paraImgHead);
    tmp.setBorder(Rectangle.NO_BORDER);
        tmp.setBorderWidth(0);
        tmp.setPadding(0);
        tmp.setUseBorderPadding(false);
        tmp.setHorizontalAlignment(Element.ALIGN_CENTER);
        head.addCell(tmp);
       
        try {
      image = Image.getInstance(PDFHeaderFooterWriter.class.getResource("/images/aufzaehl.jpg"));
    } catch (BadElementException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    } catch (MalformedURLException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    } catch (IOException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    }
    image.scalePercent(5);
   
    Paragraph paraHead0 = new Paragraph();
    paraHead0.add(new Chunk(image, 0, 0));
    paraHead0.add(new Paragraph("  Vor-Ort-Service    ", headerBigFont));
   
        tmp = new PdfPCell(paraHead0);
        tmp.setBorder(Rectangle.NO_BORDER);
        tmp.setBorderWidth(0);
        tmp.setPadding(0);
        tmp.setUseBorderPadding(false);
        tmp.setHorizontalAlignment(Element.ALIGN_CENTER);
        innerHead.addCell(tmp);
   
    try {
      image = Image.getInstance(PDFHeaderFooterWriter.class.getResource("/images/aufzaehl.jpg"));
    } catch (BadElementException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    } catch (MalformedURLException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    } catch (IOException e) {

      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null,

          e.getMessage()
              + System.getProperty("line.separator")
              + "Dies ist ein schwerwiegender Fehler."
              + System.getProperty("line.separator")
              + "Das Programm wird beendet.",
          "Fehler", JOptionPane.WARNING_MESSAGE);
      System.exit(1);

    }
    image.scalePercent(3);
   
    Paragraph paraHead1 = new Paragraph();
   
    paraHead1.add(new Chunk(image, 0, 0));
    paraHead1.add(new Phrase("  Software                      ", headerSmallFont));
    paraHead1.add(new Chunk(image, 0, 0));
    paraHead1.add(new Phrase("  Computersysteme", headerSmallFont));
   
        tmp = new PdfPCell(paraHead1);
        tmp.setBorder(Rectangle.NO_BORDER);
        tmp.setBorderWidth(0);
        tmp.setPadding(0);
        tmp.setUseBorderPadding(false);
        tmp.setHorizontalAlignment(Element.ALIGN_CENTER);
        innerHead.addCell(tmp);
   
   
    Paragraph paraHead2 = new Paragraph();
    paraHead2.add(new Phrase("    "));
    paraHead2.add(new Chunk(image, 0, 0));
    paraHead2.add(new Phrase("  Zubeh�r                       ", headerSmallFont));
    paraHead2.add(new Chunk(image, 0, 0));
    paraHead2.add(new Phrase("  Drucker", headerSmallFont));
   
        tmp = new PdfPCell(paraHead2);
        tmp.setBorder(Rectangle.NO_BORDER);
        tmp.setBorderWidth(0);
        tmp.setPadding(0);
        tmp.setUseBorderPadding(false);
        tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
        innerHead.addCell(tmp);
   
        tmp = new PdfPCell(new Paragraph(" ", headerAdressFont));
        tmp.setBorder(Rectangle.NO_BORDER);
        tmp.setBorderWidth(0);
        tmp.setPadding(0);
        tmp.setUseBorderPadding(false);
        tmp.setHorizontalAlignment(Element.ALIGN_CENTER);
        innerHead.addCell(tmp);
   
        head.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
        head.writeSelectedRows(0, -1, document.leftMargin(), document.top(),
        writer.getDirectContent());
  }
View Full Code Here

  }
    public void onEndPage(PdfWriter writer, Document document)
    {
        try {
            Rectangle page = document.getPageSize();
            PdfPTable head = new PdfPTable(4);
           
            head.getDefaultCell().setBorder(Rectangle.NO_BORDER);
           
            PdfPCell tmp = new PdfPCell(new Phrase("Bis zur vollst�ndigen Bezahlung der Ware bleibt diese Eigentum von Matthias M�ller Computerservice.", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.BOLD)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setColspan(4);
            tmp.setHorizontalAlignment(Element.ALIGN_CENTER);
            head.addCell(tmp);
           
            tmp = new PdfPCell(new Phrase("Wir machen gebrauch von der Kleinunternehmerregelung nach � 19 UStG und sind daher nicht gezwungen die Umsatzsteuer auszuweisen.", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setColspan(4);
            tmp.setHorizontalAlignment(Element.ALIGN_CENTER);
            head.addCell(tmp);
           
            tmp = new PdfPCell(new Phrase(" ", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.BOTTOM);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setColspan(4);
            tmp.setHorizontalAlignment(Element.ALIGN_CENTER);
            head.addCell(tmp);
           
            tmp = new PdfPCell(new Phrase("Anschrift:", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("Internet:", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("Telefon:", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("Bankverbindung:", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);
           
            tmp = new PdfPCell(new Phrase("Matthias M�ller", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("http://www.muellerpc.de", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("0 67 41 / 20 74 06", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("Volksbank RNH eG", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);
           
            tmp = new PdfPCell(new Phrase("Rheingoldstr. 38a", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("E-Mail:", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("Mobil:", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("BLZ 560 900 00", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("56329 St. Goar", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("kontakt@muellerpc.de", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("01 52 / 09 80 91 92", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);

            tmp = new PdfPCell(new Phrase("Konto-Nr. 1402917", new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL)));
            tmp.setBorder(Rectangle.NO_BORDER);
            tmp.setBorderWidth(0);
            tmp.setPadding(0);
            tmp.setUseBorderPadding(false);
            tmp.setHorizontalAlignment(Element.ALIGN_LEFT);
            head.addCell(tmp);           
           
            head.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
            head.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin()+50,
            writer.getDirectContent());
        }
        catch (Exception e) {
            throw new ExceptionConverter(e);
        }
View Full Code Here

      header2.add(new LineSeparator((float) 0.8, 100, BaseColor.BLACK, Element.ALIGN_CENTER, 12));
     
      Paragraph adresse = new Paragraph();
      //adresse.add(new Paragraph(" ", new Font(Font.FontFamily.TIMES_ROMAN, 8)));
      float[] relSize = {3, 2};
      PdfPTable table = new PdfPTable(relSize);
      table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
      table.setWidthPercentage(100);
     
      Font adressFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL);
     
      table.addCell("");
      table.addCell("");
      table.addCell("");
      table.addCell(new Phrase("Matthias M�ller Computerservice", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)));
      table.addCell("");
      table.addCell(new Phrase("Rheingoldstr. 38a", adressFont));
      table.addCell(anrede);
      table.addCell(new Phrase("56329 St. Goar", adressFont));
      table.addCell(vorname+" "+nachname);
      table.addCell("");
      table.addCell(strasse);
      table.addCell(new Phrase("Telefon:  0 67 41 / 20 74 06", adressFont));
      table.addCell(plz+" "+ort);
      table.addCell(new Phrase("Mobil:     01 52 / 09 80 91 92", adressFont));
      table.addCell("");
       
        //Mail
        Phrase adressPh = new Phrase();
 
        adressPh.add(new Chunk("E-Mail:   ", adressFont));
          Anchor emailLink = new Anchor("kontakt@muellerpc.de", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.UNDERLINE, new BaseColor(Color.BLUE)));
          emailLink.setReference("mailto:kontakt@muellerpc.de");
        adressPh.add(emailLink);
     
      table.addCell(adressPh);
      table.addCell("");
      table.addCell("");
      table.addCell("");
      table.addCell(new Phrase("Datum:   "+adressDate.format(date)+"", adressFont));
     
      adresse.add(table);
     
      Paragraph main = new Paragraph();
     
      main.add(new Paragraph(" "));
      main.add(new Paragraph("Gehaltsabrechnung "+monat.format(date), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)));
     
      //anfang main
     
      float[] relSizeMain = {1,1,1,1,1};
      PdfPTable tableMain = new PdfPTable(relSizeMain);
      tableMain.getDefaultCell().setBorder(Rectangle.BOX);
     
      PdfPCell cH1 = new PdfPCell(new Phrase("Krankenkasse", mainBigFont));
      cH1.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMain.addCell(cH1);
     
      PdfPCell cH2 = new PdfPCell(new Phrase("Bundesland", mainBigFont));
      cH2.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMain.addCell(cH2);
     
      PdfPCell cH3 = new PdfPCell(new Phrase("Religion", mainBigFont));
      cH3.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMain.addCell(cH3);

      PdfPCell cH4 = new PdfPCell(new Phrase("Geb. Datum", mainBigFont));
      cH4.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMain.addCell(cH4);
     
      PdfPCell cH5 = new PdfPCell(new Phrase("Kinder", mainBigFont));
      cH5.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMain.addCell(cH5);
     
      tableMain.setHeaderRows(1);
     
      tableMain.addCell(krankenkasse);
      tableMain.addCell(bundesland);
      tableMain.addCell(religion);
      tableMain.addCell(abrechnDate.format(gebDate));
      tableMain.addCell(""+kinder);
     
      float[] relSizeMainGehalt = {12,3,8,8};
      PdfPTable tableMainGehalt = new PdfPTable(relSizeMainGehalt);
      tableMainGehalt.getDefaultCell().setBorder(Rectangle.BOX);
     
      PdfPCell cA1 = new PdfPCell(new Phrase("Ab-/Bez�ge", mainBigFont));
      cA1.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMainGehalt.addCell(cA1);
     
      PdfPCell cA2 = new PdfPCell(new Phrase("%", mainBigFont));
      cA2.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMainGehalt.addCell(cA2);
     
      PdfPCell cA3 = new PdfPCell(new Phrase("Teilbetr�ge", mainBigFont));
      cA3.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMainGehalt.addCell(cA3);
     
      PdfPCell cA4 = new PdfPCell(new Phrase("Gesamtbetrag", mainBigFont));
      cA4.setHorizontalAlignment(Element.ALIGN_CENTER);
      tableMainGehalt.addCell(cA4);
     
      tableMainGehalt.setHeaderRows(1);
     
      tableMainGehalt.addCell("Bruttogehalt");
      tableMainGehalt.addCell("");
      PdfPCell c = new PdfPCell(new Phrase(df.format(bruttogehalt)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
   
      tableMainGehalt.addCell("+ Sonstige Bez�ge");
      tableMainGehalt.addCell("");
      c = new PdfPCell(new Phrase(df.format(sonstBezug)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
     
      tableMainGehalt.addCell("- Sonstige Abz�ge");
      tableMainGehalt.addCell("");
      c = new PdfPCell(new Phrase(df.format(sonstAbzug)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
     
     
      PdfPCell c6 = new PdfPCell(new Phrase("= Zu versteuerndes Einkommen"));
      c6.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c6);
     
      PdfPCell c7 = new PdfPCell(new Phrase(""));
      c7.setBorderWidthRight(0);
      c7.setBorderWidthLeft(0);
      c7.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c7);
     
      PdfPCell c8 = new PdfPCell(new Phrase(""));
      c8.setBorderWidthRight(0);
      c8.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c8);
     
      PdfPCell c9 = new PdfPCell(new Phrase(df.format(zuVersteuerndesEinkommen)));
      c9.setBorderWidthBottom(1);
      c9.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c9);
     
      tableMainGehalt.addCell("- Lohnsteuer");
      tableMainGehalt.addCell("");
      c = new PdfPCell(new Phrase(df.format(lohnsteuer)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
     
      tableMainGehalt.addCell("- Kirchensteuer");
      c = new PdfPCell(new Phrase(pf.format(prozentKirchensteuer)+" %"));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      c = new PdfPCell(new Phrase(df.format(kirchensteuer)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
     
      tableMainGehalt.addCell("- Solidarit�tszuschlag");
      tableMainGehalt.addCell("");
      c = new PdfPCell(new Phrase(df.format(soli)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
           
      PdfPCell c10 = new PdfPCell(new Phrase("= Zu Gesamte Steuerabz�ge"));
      c10.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c10);
     
      PdfPCell c11 = new PdfPCell(new Phrase(""));
      c11.setBorderWidthRight(0);
      c11.setBorderWidthLeft(0);
      c11.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c11);
     
      PdfPCell c12 = new PdfPCell(new Phrase(""));
      c12.setBorderWidthRight(0);
      c12.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c12);
     
      PdfPCell c13 = new PdfPCell(new Phrase(df.format(gesSteuerabzug)));
      c13.setBorderWidthBottom(1);
      c13.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c13);
     
     
      tableMainGehalt.addCell("- Krankenversicherung");
      c = new PdfPCell(new Phrase(pf.format(prozentKrankenversicherung)+" %"));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      c = new PdfPCell(new Phrase(df.format(krankenversicherung)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
     
      tableMainGehalt.addCell("- Pflegeversicherung");
      c = new PdfPCell(new Phrase(pf.format(prozentPflegeversicherung)+" %"));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      c = new PdfPCell(new Phrase(df.format(pflegeversicherung)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
     
      tableMainGehalt.addCell("- Rentenversicherung");
      c = new PdfPCell(new Phrase(pf.format(prozentRentenversicherung)+" %"));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      c = new PdfPCell(new Phrase(df.format(rentenversicherung)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
     
      tableMainGehalt.addCell("- Arbeitslosenversicherung");
      c = new PdfPCell(new Phrase(pf.format(prozentArbeitslosenversicherung)+" %"));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      c = new PdfPCell(new Phrase(df.format(arbeitslosenversicherung)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
      tableMainGehalt.addCell("");
           
      PdfPCell c14 = new PdfPCell(new Phrase("= Gesamte Sozialver. Abz�ge"));
      c14.setBorderWidthTop(0);
      c14.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c14);
     
      PdfPCell c15 = new PdfPCell(new Phrase(""));
      c15.setBorderWidthTop(0);
      c15.setBorderWidthRight(0);
      c15.setBorderWidthLeft(0);
      c15.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c15);
     
      PdfPCell c16 = new PdfPCell(new Phrase(""));
      c16.setBorderWidthTop(0);
      c16.setBorderWidthRight(0);
      c16.setBorderWidthBottom(1);
      tableMainGehalt.addCell(c16);
     
      PdfPCell c17 = new PdfPCell(new Phrase(df.format(gesSozialversicherungsabzug)));
      c17.setBorderWidthTop(0);
      c17.setBorderWidthBottom(1);
      c17.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c17);
     
      tableMainGehalt.addCell("= Nettogehalt");
      tableMainGehalt.addCell("");
      tableMainGehalt.addCell("");
      c = new PdfPCell(new Phrase(df.format(nettogehalt)));
      c.setHorizontalAlignment(Element.ALIGN_RIGHT);
      tableMainGehalt.addCell(c);
     
     
      PdfPCell c18 = new PdfPCell(new Phrase(""));
      c18.setColspan(4);
      c18.setBorderWidth(1);
      c18.setBorderWidthLeft(0);
      c18.setBorderWidthRight(0);
      tableMainGehalt.addCell(c18);
     
     
      PdfPCell c19 = new PdfPCell(new Phrase(""));
      c19.setColspan(4);
      c19.setBorderWidth(0);
      tableMainGehalt.addCell(c19);
     
      float[] relSizeBorder = {1};
      PdfPTable tableBorder = new PdfPTable(relSizeBorder);
      tableBorder.getDefaultCell().setBorderWidth(1);
      tableBorder.setWidthPercentage(100);
      tableBorder.addCell(tableMain);
      tableBorder.addCell(tableMainGehalt);
     
      main.add(tableBorder);
      //ende main
      PdfPTable header1 = new PdfPTable(1);
      PdfPCell cell = new PdfPCell(new Phrase(" ", FontFactory.getFont(FontFactory.HELVETICA, 54)));
      cell.setBorder(Rectangle.NO_BORDER);
      cell.setBorderWidth(0);
      header1.addCell(cell);
      header1.setTotalWidth(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin());
      document.add(header1);
      document.add(header2);
      document.add(adresse);
      document.add(main);
    }
View Full Code Here

   * @throws DocumentException
   * @since 5.0.6
   */
  public void processTable() throws DocumentException{
    TableWrapper table = (TableWrapper) stack.pop();
    PdfPTable tb = table.createTable();
    tb.setSplitRows(true);
    if (stack.empty())
      document.add(tb);
    else
      ((TextElementArray) stack.peek()).add(tb);
  }
View Full Code Here

    document.add(oneEmptyLine);

    /**
     * Table of heats
     */
    PdfPTable table = getHeatTable();
    document.add(table);

    // Start a new page
    document.newPage();
  }
View Full Code Here

TOP

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

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.