Package com.lowagie.text

Examples of com.lowagie.text.Chunk


        // newpage
        if (isNewpage(name)) {
            TextElementArray current;
            try {
                current = (TextElementArray) stack.pop();
                Chunk newPage = new Chunk("");
                newPage.setNewPage();
                if (bf != null) {
                  newPage.setFont(new LwgFont(this.bf));
                }
                current.add(newPage);
                stack.push(current);
            } catch (EmptyStackException ese) {
                document.newPage();
View Full Code Here


                buf.append(character);
            }
        }
        if (currentChunk == null) {
          if (bf == null) {
            currentChunk = new Chunk(buf.toString());
          }
          else {
            currentChunk = new Chunk(buf.toString(), new LwgFont(this.bf));
          }
        } else {
            currentChunk.append(buf.toString());
        }
    }
View Full Code Here

      }
      else if (bookmark.get("Page") != null) {
        String page = (String)bookmark.get("Page");
        StringTokenizer tokens = new StringTokenizer(page);
        String token = tokens.nextToken();
        anchor.add(new Chunk(" page " + token));
        remote = remote + "#page=" + token;
      }
      anchor.setReference(remote);
      title.add(anchor);
    }
View Full Code Here

           LwgFont fnt,
           LwgFont fntSubscript,
           float fltTextRise) throws Exception
   {
      LwgPhrase phr = new LwgPhrase();
      Chunk c;
      c = new Chunk(str, fnt);
      c.setTextRise(0f);
      phr.add(c);
      c = new Chunk(strSubscript, fntSubscript);
      c.setTextRise(fltTextRise);
      phr.add(c);

      return phr;
   }
View Full Code Here

           String strSupscript,
           LwgFont fnt,
           LwgFont fntSupscript) throws Exception
   {
      LwgPhrase phr = new LwgPhrase();
      Chunk c;
      c = new Chunk(str, fnt);
      c.setTextRise(0f);
      phr.add(c);
      c = new Chunk(strSupscript, fntSupscript);
      c.setTextRise(3.0f);
      phr.add(c);

      return phr;
   }
View Full Code Here

            rtfElement.setRtfDocument(this.rtfDoc);
            return new RtfBasicElement[]{rtfElement};
        }
        switch(element.type()) {
        case LwgElement.CHUNK:
            Chunk chunk = (Chunk) element;
            if(chunk.hasAttributes()) {
                if(chunk.getAttributes().containsKey(Chunk.IMAGE)) {
                    rtfElements.add(new RtfImage(rtfDoc, chunk.getImage()));
                } else if(chunk.getAttributes().containsKey(Chunk.NEWPAGE)) {
                    rtfElements.add(new RtfNewPage(rtfDoc));
                } else if(chunk.getAttributes().containsKey(Chunk.TAB)) {
                        Float tabPos = (Float) ((Object[]) chunk.getAttributes().get(Chunk.TAB))[1];
                        RtfTab tab = new RtfTab(tabPos.floatValue(), RtfTab.TAB_LEFT_ALIGN);
                        tab.setRtfDocument(rtfDoc);
                        rtfElements.add(tab);
                        rtfElements.add(new RtfChunk(rtfDoc, new Chunk("\t")));
                } else {
                        rtfElements.add(new RtfChunk(rtfDoc, (Chunk) element));
                }
            } else {
                    rtfElements.add(new RtfChunk(rtfDoc, (Chunk) element));
View Full Code Here

            Paragraph p = new Paragraph();
            p.add(new RtfTableOfContents("UPDATE ME!"));
            doc.add(p);

            p = new Paragraph("", new RtfFont("Staccato222 BT"));
            p.add(new Chunk("Hello! "));
            p.add(new Chunk("How do you do?"));
            doc.add(p);
            p.setAlignment(LwgElement.ALIGN_RIGHT);
            doc.add(p);

            Anchor a = new Anchor("http://www.uni-klu.ac.at");
            a.setReference("http://www.uni-klu.ac.at");
            doc.add(a);

            LwgImage img = LwgImage.getInstance("pngnow.png");
            doc.add(new Chunk(img, 0, 0));
            doc.add(new Annotation("Mark", "This works!"));

            Chunk c = new Chunk("");
            c.setNewPage();
            doc.add(c);

            List subList = new List(true, 40);
            subList.add(new ListItem("Sub list 1"));
            subList.add(new ListItem("Sub list 2"));
View Full Code Here

      PdfWriter.getInstance(document, new FileOutputStream("Paragraphs.pdf"));

      // step 3: we open the document
      document.open();
      // step 4:
      Paragraph p1 = new Paragraph(new Chunk(
          "This is my first paragraph. ",
          FontFactory.getFont(FontFactory.HELVETICA, 10)));
      p1.add("The leading of this paragraph is calculated automagically. ");
      p1.add("The default leading is 1.5 times the fontsize. ");
      p1.add(new Chunk("You can add chunks "));
      p1.add(new LwgPhrase("or you can add phrases. "));
      p1.add(new LwgPhrase(
        "Unless you change the leading with the method setLeading, the leading doesn't change if you add text with another leading. This can lead to some problems.",
        FontFactory.getFont(FontFactory.HELVETICA, 18)));
      document.add(p1);
View Full Code Here

            document.open();
           
            // step 4: we add content to the document
            BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
            LwgFont font = new LwgFont(helvetica, 12, LwgFont.NORMAL);
            Chunk chunk = new Chunk("Sponsor this example and send me 1\u20ac. These are some special characters: \u0152\u0153\u0160\u0161\u0178\u017D\u0192\u02DC\u2020\u2021\u2030", font);
            document.add(chunk);
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
View Full Code Here

    if(this.rtfParser.isConvert()) {
      if(this.buffer.length() > 0 && this.iTextParagraph == null) {
        this.iTextParagraph = new Paragraph();
      }
      if(this.buffer.length() > 0 ) {
        Chunk chunk = new Chunk();
        chunk.append(this.buffer.toString());
        this.iTextParagraph.add(chunk);
      }
      if(this.iTextParagraph != null) {
        addParagraphToDocument();
      }
View Full Code Here

TOP

Related Classes of com.lowagie.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.