Package com.itextpdf.text

Examples of com.itextpdf.text.Chunk


      if (content.trim().length() == 0 && content.indexOf(' ') < 0) {
        return;
      }
      content = HtmlUtilities.eliminateWhiteSpace(content);
    }
    Chunk chunk = createChunk(content);
    currentParagraph.add(chunk);
  }
View Full Code Here


        carriageReturn();
      }
      if (currentParagraph == null) {
        currentParagraph = createParagraph();
      }
      currentParagraph.add(new Chunk(img, 0, 0, true));
      currentParagraph.setAlignment(HtmlUtilities.alignmentValue(align));
      if (align != null) {
        carriageReturn();
      }
    }
View Full Code Here

                // 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

    }

    private Phrase composePhrase(String text, BaseFont ufont, BaseColor color, float fontSize) {
        Phrase phrase = null;
        if (extensionFont == null && (substitutionFonts == null || substitutionFonts.isEmpty()))
            phrase = new Phrase(new Chunk(text, new Font(ufont, fontSize, 0, color)));
        else {
            FontSelector fs = new FontSelector();
            fs.addFont(new Font(ufont, fontSize, 0, color));
            if (extensionFont != null)
                fs.addFont(new Font(extensionFont, fontSize, 0, color));
View Full Code Here

                    app.setGrayFill(0);
                else
                    app.setColorFill(textColor);
                app.beginText();
                for (int k = 0; k < phrase.size(); ++k) {
                    Chunk ck = (Chunk)phrase.get(k);
                    BaseFont bf = ck.getFont().getBaseFont();
                    app.setFontAndSize(bf, usize);
                    StringBuffer sb = ck.append("");
                    for (int j = 0; j < sb.length(); ++j) {
                        String c = sb.substring(j, j + 1);
                        float wd = bf.getWidthPoint(c, usize);
                        app.setTextMatrix(extraMarginLeft + start - wd / 2, offsetY - extraMarginTop);
                        app.showText(c);
View Full Code Here

                  table.addCell(new Phrase(colValue));
                }
              }
            }
           
            document.add(new Chunk(label, new Font(FontFamily.HELVETICA, 12, Font.BOLD)));
            document.add(new Chunk(Chunk.NEWLINE));
            document.add(table);
            document.add(new Chunk(Chunk.NEWLINE));
          }
        } else {
          document.add(getAttributeParagraph(label, value));
        }
      }
View Full Code Here

    }
  }

  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

        if (fit) {
            this.image = image;
            setPadding(borderWidth / 2);
        }
        else {
            column.addText(this.phrase = new Phrase(new Chunk(image, 0, 0, true)));
            setPadding(0);
        }
    }
View Full Code Here

   * @param chain the hierarchy chain
   * @return a Chunk
   */
  public Chunk createChunk(final String content, final ChainedProperties chain) {
    Font font = getFont(chain);
    Chunk ck = new Chunk(content, font);
    if (chain.hasProperty(HtmlTags.SUB))
      ck.setTextRise(-font.getSize() / 2);
    else if (chain.hasProperty(HtmlTags.SUP))
      ck.setTextRise(font.getSize() / 2);
    ck.setHyphenation(getHyphenation(chain));
    return ck;
  }
View Full Code Here

    }

    private Phrase composePhrase(String text, BaseFont ufont, BaseColor color, float fontSize) {
        Phrase phrase = null;
        if (extensionFont == null && (substitutionFonts == null || substitutionFonts.isEmpty()))
            phrase = new Phrase(new Chunk(text, new Font(ufont, fontSize, 0, color)));
        else {
            FontSelector fs = new FontSelector();
            fs.addFont(new Font(ufont, fontSize, 0, color));
            if (extensionFont != null)
                fs.addFont(new Font(extensionFont, fontSize, 0, color));
View Full Code Here

TOP

Related Classes of com.itextpdf.text.Chunk

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.