Package com.lowagie.text

Examples of com.lowagie.text.Paragraph


      }
      writeText("}");
    }
    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);
View Full Code Here


      if(charProperties.containsKey(RtfProperty.CHARACTER_UNDERLINE)) fs |= LwgFont.UNDERLINE;
      LwgFont useFont = FontFactory.getFont(currFont.getFamilyname(), 12, fs, new Color(0,0,0));
     
     
      chunk.setFont(useFont);
      if(iTextParagraph == null) this.iTextParagraph = new Paragraph();
      this.iTextParagraph.add(chunk);

    } else {
      if(propertyName.startsWith(RtfProperty.PARAGRAPH)) {
        // this is a paragraph change. what do we do?
View Full Code Here

         aTable.addCell("2.2", new Point(2, 2));
         aTable.addCell("3.3", new Point(3, 3));
         aTable.addCell("2.1", new Point(2, 1));
         aTable.insertTable(secondTable, new Point(1, 3));
         document.add(aTable);
         document.add(new Paragraph("converted to PdfPTable:"));
         aTable.setConvert2pdfptable(true);
         document.add(aTable);
         document.newPage();

         // example 2

         Table thirdTable = new Table(2);
         thirdTable.addCell("3rd table 0.0");
         thirdTable.addCell("3rd table 0.1");
         thirdTable.addCell("3rd table 1.0");
         thirdTable.addCell("3rd table 1.1");

         aTable = new Table(5, 5);
         aTable.setAutoFillEmptyCells(true);
         aTable.addCell("2.2", new Point(2, 2));
         aTable.addCell("3.3", new Point(3, 3));
         aTable.addCell("2.1", new Point(2, 1));
         aTable.insertTable(secondTable, new Point(1, 3));
         aTable.insertTable(thirdTable, new Point(6, 2));
         document.add(aTable);
         document.add(new Paragraph("converted to PdfPTable:"));
         aTable.setConvert2pdfptable(true);
         document.add(aTable);
         document.newPage();

         // example 3
         aTable = new Table(3);
         float[] widths =
         {
            1, 2, 1
         };
         aTable.setWidths(widths);
         aTable.addCell("1.1");
         aTable.addCell("1.2");
         aTable.addCell("1.3");
         // nested
         Table t2 = new Table(2);
         t2.addCell("2.1");
         t2.addCell("2.2");

         // now insert the nested
         aTable.insertTable(t2);
         aTable.addCell("new cell");
         document.add(aTable);
         document.add(new Paragraph("converted to PdfPTable:"));
         aTable.setConvert2pdfptable(true);
         document.add(aTable);
         document.newPage();

         // relative column widths are preserved

         Table a = new Table(2);
         a.setWidths(new float[]
                 {
                    85, 15
                 });
         a.addCell("a-1");
         a.addCell("a-2");

         Table b = new Table(5);
         b.setWidths(new float[]
                 {
                    15, 7, 7, 7, 7
                 });
         b.addCell("b-1");
         b.addCell("b-2");
         b.addCell("b-3");
         b.addCell("b-4");
         b.addCell("b-5");

         // now, insert these 2 tables into a third for layout purposes
         Table c = new Table(3, 1);
         c.setWidth(100.0f);
         c.setWidths(new float[]
                 {
                    20, 2, 78
                 });
         c.insertTable(a, new Point(0, 0));
         c.insertTable(b, new Point(0, 2));

         document.add(c);
         document.add(new Paragraph("converted to PdfPTable:"));
         c.setConvert2pdfptable(true);
         document.add(c);

      }
      catch (DocumentException de)
View Full Code Here

      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(4);
      LwgPdfPCell cell;
      cell = new LwgPdfPCell(new Paragraph("test colors:"));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("red"));
      cell.setBorder(LwgRectangle.NO_BORDER);
      cell.setBackgroundColor(Color.red);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("green"));
      cell.setBorder(LwgRectangle.BOTTOM);
      cell.setBorderColorBottom(Color.magenta);
      cell.setBorderWidthBottom(10f);
      cell.setBackgroundColor(Color.green);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("blue"));
      cell.setBorder(LwgRectangle.TOP);
          cell.setUseBorderPadding(true);
      cell.setBorderWidthTop(5f);
      cell.setBorderColorTop(Color.cyan);
      cell.setBackgroundColor(Color.blue);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("test GrayFill:"));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("0.25"));
      cell.setBorder(LwgRectangle.NO_BORDER);
      cell.setGrayFill(0.25f);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("0.5"));
      cell.setBorder(LwgRectangle.NO_BORDER);
      cell.setGrayFill(0.5f);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("0.75"));
      cell.setBorder(LwgRectangle.NO_BORDER);
      cell.setGrayFill(0.75f);
      table.add(cell);
      document.add(table);
    } catch (Exception de) {
View Full Code Here

            LwgDocument document = new LwgDocument();
            RtfWriter2.getInstance(document, new FileOutputStream("DrawingObjects.rtf"));

            document.open();

            document.add(new Paragraph("This text will wrap around the shape that\n" +
                    "we will define. Different\n" +
                    "wrapping modes are possible."));
           
            // Create a new RtfShape of the type RECTANGLE.
            // The position defines the extent of the shape in the page (in Twips)
View Full Code Here

      document.newPage();
      Speaker speaker;
      for (Iterator i = events.getSpeakers().iterator(); i.hasNext();) {
        speaker = (Speaker) i.next();
        document.add(new Paragraph(speaker.getName() + ": "
            + speaker.getOccurrence() + " speech blocks"));
      }
      document.close();

    } catch (Exception e) {
View Full Code Here

            LwgDocument document = new LwgDocument();
            RtfWriter2.getInstance(document, new FileOutputStream("SoftLineBreak.rtf"));

            document.open();

            document.add(new Paragraph("This is just a paragraph."));
           
            Paragraph par = new Paragraph();

            // Set the spacings just to demonstrate that the soft linebreak
            // does not cause spacing before or after
            par.setSpacingBefore(10);
            par.setSpacingAfter(10);
           
            // Add the contents before the linebreak
            par.add("This paragraph contains a soft linebreak");

            // Add the soft linebreak
            par.add(RtfDirectContent.DIRECT_SOFT_LINEBREAK);

            // Add the contents after the linebreak
            par.add("just before the just.");
           
            // Add the paragraph to the document
            document.add(par);

            document.add(new Paragraph("This is just a paragraph."));
           
            document.close();
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
        } catch (DocumentException de) {
View Full Code Here

          new FileOutputStream("Rendering.pdf"));

      // step 3: we open the document
      document.open();
      // step 4:     
      Paragraph p = new Paragraph("Text Rendering:");
      document.add(p);
      Chunk chunk = new Chunk("rendering test");
      chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL, 100f, new Color(0xFF, 0x00, 0x00));
      document.add(chunk);
      document.add(Chunk.NEWLINE);
View Full Code Here

        // we want to add a paragraph after the speaker chunk
        if ("SPEAKER".equals(name)) {
          try {
            TextElementArray previous = (TextElementArray) stack
                .pop();
            previous.add(new Paragraph(16));
            stack.push(previous);
          } catch (EmptyStackException ese) {
          }
        }
      } else {
View Full Code Here

      writer.setPageEvent(new Generic());
     
      // step 3: we open the document
      document.open();
      // step 4:
      Paragraph p = new Paragraph("Generic page event");
      document.add(p);
      Chunk box = new Chunk("box");
      box.setGenericTag("box");
      Chunk ellipse = new Chunk("ellipse");
      ellipse.setGenericTag("ellipse");
      p = new Paragraph("In this example, we will add chunks that are tagged as an ");
      p.add(ellipse);
      p.add(" and chunks that are tagged as a ");
      p.add(box);
      p.add(". Can you see the difference between ");
      Chunk c1 = new Chunk("this");
      c1.setGenericTag("box");
      Chunk c2 = new Chunk("that");
      c2.setGenericTag("ellipse");
      p.add(c1);
      p.add(" and ");
      p.add(c2);
      p.add("? One is a ");
      p.add(box);
      p.add("; the other an ");
      p.add(ellipse);
      document.add(p);
    } catch (DocumentException de) {
      System.err.println(de.getMessage());
    } catch (IOException ioe) {
      System.err.println(ioe.getMessage());
View Full Code Here

TOP

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