Package com.itextpdf.text

Examples of com.itextpdf.text.Phrase


     * @param value cell value
     * @return Cell
     */
    private PdfPCell getCell(String value)
    {
        PdfPCell cell = new PdfPCell(new Phrase(new Chunk(StringUtils.trimToEmpty(value), smallFont)));
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setLeading(8, 0);
        cell.setPadding(2);
        return cell;
    }
View Full Code Here


    @Override
    protected void writePostBodyFooter(TableModel model) throws DocumentException
    {
        Chunk cellContent = new Chunk(model.getFooter(), this.getFooterFont());
        this.setFooterFontStyle(cellContent);
        PdfPCell cell = new PdfPCell(new Phrase(cellContent));
        cell.setLeading(8, 0);
        cell.setBackgroundColor(this.getFooterBackgroundColor());
        cell.setHorizontalAlignment(this.getFooterHorizontalAlignment());
        cell.setColspan(model.getNumberOfColumns());
        table.addCell(cell);
View Full Code Here

     * @return Cell
     * @throws BadElementException if errors occurs while generating content.
     */
    private PdfPCell getCell(Object value)
    {
        PdfPCell cell = new PdfPCell(new Phrase(new Chunk(StringUtils.trimToEmpty(value != null
            ? value.toString()
            : StringUtils.EMPTY), this.defaultFont)));
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setLeading(8, 0);
        return cell;
View Full Code Here

     */
    private PdfPCell getHeaderCell(String value)
    {
        Chunk cellContent = new Chunk(value, this.getHeaderFont());
        setHeaderFontStyle(cellContent);
        PdfPCell cell = new PdfPCell(new Phrase(cellContent));
        cell.setLeading(8, 0);
        cell.setHorizontalAlignment(this.getHeaderHorizontalAlignment());
        cell.setBackgroundColor(this.getHeaderBackgroundColor());
        return cell;
    }
View Full Code Here

     * @param value Value to display in the cell.
     * @return A cell with the given value.
     */
    private PdfPCell getCell(String value)
    {
        PdfPCell cell = new PdfPCell(new Phrase(new Chunk(value, this.font)));
        cell.setLeading(8, 0);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        return cell;
    }
View Full Code Here

      imageAnchor.setReference("#anhang-d-" + listImages_D.size());
      // imageAnchor.setReference("#i-" + person.getXREFID());
      listImages_D.add(image);
      listPersons_D.add(person);
      document.add(imageAnchor);
      document.add(new Phrase(" "));
    } catch (MalformedURLException exception) {
      // Dann halt kein Image einbinden.
      System.err.println("Image " + imageFile.getAbsolutePath() + " konnte nicht in das PDF eingebunden werden:");
      exception.printStackTrace();
    } catch (IOException exception) {
View Full Code Here

    table.setWidthPercentage(100);
    table.getDefaultCell().setPaddingLeft(0);
    table.getDefaultCell().setBorderWidth(0);
    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.setWidths(new int[] {16, 100 - 16});
    table.addCell(new Phrase(" "));
    table.addCell(new Phrase(" "));
    return table;
  }
View Full Code Here

  /**
   * Adds a single data line, if the data is not empty.
   */
  private void addSingleDataLine(PdfPTable table, String title, String data, boolean withDateLinks, String niceData) {
    if (data != null && data.trim().length() > 0) {
      Phrase phrase = new Phrase(title + ": ", fontHelvetica12Bold);
      table.addCell(phrase);
      Phrase phrase2 = new Phrase();
      if (withDateLinks) {
        createTableCellWithDateLinks(data, niceData, phrase2);
      }
      else {
        phrase = new Phrase(niceData == null ? data : niceData);
        phrase2.add(phrase);
      }
      table.addCell(phrase2);
    }
  }
View Full Code Here

  /**
   * Create a table cell with a date as data.
   */
  private void createTableCellWithDateLinks(String data, String niceDate, Phrase phrase2) {
    Phrase phrase;
    int ndSpace1 = niceDate.indexOf(' ');
    int ndSpace2 = ndSpace1 < 0 ? -1 : niceDate.indexOf(' ', ndSpace1 + 1);
    String dayMonth = data.substring(0, data.lastIndexOf('.'));
    String year = data.substring(data.lastIndexOf('.') + 1);
    if (!dayMonth.contains("?")) {
      Anchor anchor = new Anchor(new Phrase(niceDate.substring(0, ndSpace2 < 0 ? niceDate.length() : ndSpace2)));
      anchor.setReference("#dm-" + dayMonth);
      phrase2.add(anchor);
    }
    else {
      phrase =
        new Phrase(year.contains("?") ? niceDate : niceDate.substring(0, Math.max(0, Math.max(ndSpace1, ndSpace2))));
      phrase2.add(phrase);
    }
    phrase = new Phrase(" ");
    phrase2.add(phrase);
    if (!year.contains("?")) {
      Anchor anchor = new Anchor(new Phrase(year));
      anchor.setReference("#y-" + year);
      phrase2.add(anchor);
    }
    else {
      phrase = new Phrase(year);
      phrase2.add(phrase);
    }
  }
View Full Code Here

        imageAnchor.setName("anhang-d-" + i);
        imageAnchor.setReference("#p-" + person.getXREFID());
        document.add(imageAnchor);

        // Etwas Platz zum n�chsten Image lassen.
        document.add(new Phrase(" "));
      }
      document.add(new Paragraph());
    }
  }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.Phrase

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.