Package com.itextpdf.text

Examples of com.itextpdf.text.Paragraph


   * Adds a link to the current paragraph.
   * @since 5.0.6
   */
  public void processLink() {
    if (currentParagraph == null) {
      currentParagraph = new Paragraph();
    }
    // The link provider allows you to do additional processing
    LinkProcessor i = (LinkProcessor) providers.get(HTMLWorker.LINK_PROVIDER);
    if (i == null || !i.process(currentParagraph, chain)) {
      // sets an Anchor for all the Chunks in the current paragraph
      String href = chain.getProperty(HtmlTags.HREF);
      if (href != null) {
        for (Chunk ck : currentParagraph.getChunks()) {
          ck.setAnchor(href);
        }
      }
    }
    // a link should be added to the current paragraph as a phrase
    if (stack.isEmpty()) {
      // no paragraph to add too, 'a' tag is first element
      Paragraph tmp = new Paragraph(new Phrase(currentParagraph));
      currentParagraph = tmp;
    } else {
      Paragraph tmp = (Paragraph) stack.pop();
      tmp.add(new Phrase(currentParagraph));
      currentParagraph = tmp;
    }
  }
View Full Code Here


                ct2.setSimpleColumn(signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), 0, Element.ALIGN_RIGHT);

                Image im = Image.getInstance(signatureGraphic);
                im.scaleToFit(signatureRect.getWidth(), signatureRect.getHeight());

                Paragraph p = new Paragraph();
                // must calculate the point to draw from to make image appear in middle of column
                float x = 0;
                // experimentation found this magic number to counteract Adobe's signature graphic, which
                // offsets the y co-ordinate by 15 units
                float y = -im.getScaledHeight() + 15;

                x = x + (signatureRect.getWidth() - im.getScaledWidth()) / 2;
                y = y - (signatureRect.getHeight() - im.getScaledHeight()) / 2;
                p.add(new Chunk(im, x + (signatureRect.getWidth() - im.getScaledWidth()) / 2, y, false));
                ct2.addElement(p);
                ct2.go();
                break;
            case GRAPHIC:
                ct2 = new ColumnText(t);
                ct2.setRunDirection(runDirection);
                ct2.setSimpleColumn(signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), 0, Element.ALIGN_RIGHT);

                im = Image.getInstance(signatureGraphic);
                im.scaleToFit(signatureRect.getWidth(), signatureRect.getHeight());

                p = new Paragraph(signatureRect.getHeight());
                // must calculate the point to draw from to make image appear in middle of column
                x = (signatureRect.getWidth() - im.getScaledWidth()) / 2;
                y = (signatureRect.getHeight() - im.getScaledHeight()) / 2;
                p.add(new Chunk(im, x, y, false));
                ct2.addElement(p);
                ct2.go();
                break;
            default:
            }
View Full Code Here

    return fis;
  }

  private void doHeader() {

    Paragraph heading = new Paragraph("\n\n\nDriveTogether Statistik",
        FontFactory.getFont(FontFactory.COURIER_BOLD, 18,
            new BaseColor(colorFH)));

    // Chapter chapter1 = new Chapter(heading,1);

    Paragraph subHeading = new Paragraph("Routes for: " + getForUser(),
        FontFactory.getFont(FontFactory.COURIER, 16, new BaseColor(
            colorBlue)));

    try {
      doc.add(heading);
View Full Code Here

  }

  private void doParagraph(List<RouteInfo> trip, String forUser) {
    for (RouteInfo t : trip) {
      // if (t.getUser().getId() == user.getId()) {
      Paragraph someText = new Paragraph("\n########## " + t.getFrom()
          + " - " + t.getTo() + " ##########" + "\nDepature: "
          + t.getDepartureDate() + " - " + t.getDepartureTime()
          + " @ " + t.getArrivalDate() + " - " + t.getArrivalTime()
          + "\nSeats: " + t.getTrip().getSeats() + "\n\nDriver Info:"
          + "\nName: " + t.getDriverFullName() + "\nPhone: "
View Full Code Here

      response.setHeader("Content-Disposition", "inline; filename=" + module + ".pdf"); // TODO add more information about the entity into the filename.

      final Dto dto = readService.get(module, id);
      final ModuleDto moduleDto = config.getModuleDtos().get(module);

      document.add(new Paragraph(moduleDto.getTitle(), new Font(FontFamily.HELVETICA, 20, Font.BOLD)));
     
      for (final Entry<String, Serializable> entry : dto.getAllData().entrySet()) {
        if ("id".equals(entry.getKey()) || entry.getKey().endsWith("_resolved")) {
          continue;
        }
View Full Code Here

      ex.printStackTrace();
    }
  }

  protected Element getAttributeParagraph(final String key, final String value) {
    final Paragraph p = new Paragraph();
    p.add(new Chunk(key + ": ", new Font(FontFamily.HELVETICA, 12, Font.BOLD)));
    p.add(new Chunk(value));
    return p;
  }
View Full Code Here

            PdfWriter.getInstance(doc, os); //associa a stream de saída ao

            doc.open(); //abre o documento
            Font fonte2 = new Font(FontFamily.HELVETICA, 24,Font.BOLD);
            Font fonte = new Font(FontFamily.HELVETICA, 16,Font.BOLD);
            Paragraph title = new Paragraph("Relatório iCards",fonte2); //adiciona o texto ao PDF
            title.setAlignment(Element.ALIGN_CENTER);
            title.setSpacingAfter(5);
            Paragraph linha = new Paragraph("__________________________________________________",fonte);
            doc.add(linha);
            doc.add(title);
           
            GerenciarDB banco = new GerenciarDB();
           
            if (tipo==0) { //Usuario
                String[][] mtx = banco.getExtratoUsuario(ID);
                int i;
                PdfPTable table = new PdfPTable(3);
               
                Paragraph head = new Paragraph("Nome: "+banco.getUsername(ID) ,fonte);
                head.setSpacingAfter(20);
                doc.add(head);
               
                for (i=(mtx[0].length)-1;i>=0;i--){
                    table.addCell(mtx[0][i]);
                    table.addCell(mtx[1][i]);
                    table.addCell(mtx[2][i]);
               }
               doc.add(table);
               Paragraph fim = new Paragraph("Saldo total: R$ "+banco.getSaldoCartaoDB(ID) ,fonte);
               doc.add(fim);
             
            } else if (tipo==1) { //Estabelecimento
                String[][] mtx = banco.getExtratoEst(ID);
                int j;
                PdfPTable table = new PdfPTable(2);
               
                Paragraph head = new Paragraph("Nome: "+banco.getEstabelecimentoDB(ID) ,fonte);
                head.setSpacingAfter(20);
                doc.add(head);

                for (j=(mtx[0].length)-1;j>=0;j--){
                    table.addCell(mtx[0][j]);
                    table.addCell(mtx[2][j]);
                }
                doc.add(table);
                Paragraph fim = new Paragraph("Receita total: R$ "+banco.getVendaTotalEstabelecimentoDB(ID) ,fonte);
                doc.add(fim);
            } else {
                System.out.println("Relatório não gerado");
            }
            doc.add(linha);
View Full Code Here

   * of the different tags and properties in the hierarchy chain.
   * @param  chain  the hierarchy chain
   * @return  a Paragraph without any content
   */
  public Paragraph createParagraph(final ChainedProperties chain) {
    Paragraph paragraph = new Paragraph();
    updateElement(paragraph, chain);
    return paragraph;
  }
View Full Code Here

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

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

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

            }
            catch(Exception de) {
                throw new ExceptionConverter(de);
            }
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.