Package com.lowagie.text

Examples of com.lowagie.text.Paragraph


        }
       
        this.cellPadding = (int) this.parentRow.getParentTable().getCellPadding();
       
        Iterator cellIterator = cell.getElements();
        Paragraph container = null;
        while(cellIterator.hasNext()) {
            try {
                LwgElement element = (LwgElement) cellIterator.next();
                // should we wrap it in a paragraph
                if(!(element instanceof Paragraph) && !(element instanceof List)) {
                    if(container != null) {
                        container.add(element);
                    } else {
                        container = new Paragraph();
                        container.setAlignment(cell.getHorizontalAlignment());
                        container.add(element);
                    }
                } else {
                    if(container != null) {
                        RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(container);
                        for(int i = 0; i < rtfElements.length; i++) {
View Full Code Here


        // does it have column composite info?
        java.util.List compositeElements = cell.getCompositeElements();
        if(compositeElements != null) {
          Iterator cellIterator = compositeElements.iterator();
          // does it have column info?
          Paragraph container = null;
          while(cellIterator.hasNext()) {
              try {
                  LwgElement element = (LwgElement) cellIterator.next();
                  // should we wrap it in a paragraph
                  if(!(element instanceof Paragraph) && !(element instanceof List)) {
                      if(container != null) {
                          container.add(element);
                      } else {
                          container = new Paragraph();
                          container.setAlignment(cell.getHorizontalAlignment());
                          container.add(element);
                      }
                  } else {
                      if(container != null) {
                          RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(container);
                          for(int i = 0; i < rtfElements.length; i++) {
View Full Code Here

          new GfrFileOutputStream("com.lowagie.examples.objects.tables.TableSpacing.pdf"));
      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(3);
      LwgPdfPCell cell = new LwgPdfPCell(new Paragraph("header with colspan 3"));
      cell.setColspan(3);
      table.add(cell);
      table.add("1.1");
      table.add("2.1");
      table.add("3.1");
      table.add("1.2");
      table.add("2.2");
      table.add("3.2");
      cell = new LwgPdfPCell(new Paragraph("cell test1"));
      cell.setBorderColor(new Color(255, 0, 0));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("cell test2"));
      cell.setColspan(2);
      cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
      table.add(cell);
      table.setWidthPercentage(50);
      document.add(new Paragraph("We add 2 tables:"));
      document.add(table);
      document.add(table);
      document.add(new Paragraph("They are glued to eachother"));
      document.add(table);
      document.add(new Paragraph("This is not very nice. Turn to the next page to see how we solved this"));
      document.newPage();
      document.add(new Paragraph("We add 2 tables, but with a certain 'SpacingBefore':"));
      table.setSpacingBefore(15f);
      document.add(table);
      document.add(table);
      document.add(new Paragraph("Unfortunately, there was no spacing after."));
      table.setSpacingAfter(15f);
      document.add(table);
      document.add(new Paragraph("This is much better, don't you think so?"));
    } catch (Exception de) {
      de.printStackTrace();
    }
    // step5
    document.close();
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.addCell("1.3", new Point(1,3));
            document.add(aTable);
      document.add(new Paragraph("converted to PdfPTable:"));
      aTable.setConvert2pdfptable(true);
      document.add(aTable);
            document.newPage();    
            aTable = new Table(4,4);    // 4 rows, 4 columns
            aTable.setAlignment(LwgElement.ALIGN_CENTER);
            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.addCell("1.3", new Point(1,3));
            aTable.addCell("5.2", new Point(5,2));
            aTable.addCell("6.1", new Point(6,1));
            aTable.addCell("5.0", new Point(5,0))
            document.add(aTable);
      document.add(new Paragraph("converted to PdfPTable:"));
      aTable.setConvert2pdfptable(true);
      document.add(aTable);
            document.newPage();
            aTable = new Table(2,2);    // 2 rows, 2 columns
            aTable.setAlignment(LwgElement.ALIGN_LEFT);
            aTable.setAutoFillEmptyCells(true);
            aTable.addCell("0.0");
            aTable.addCell("0.1");
            aTable.addCell("1.0");
            aTable.addCell("1.1");
            aTable.addColumns(2);
            float[] f = {1f, 1f, 1f, 1f};
            aTable.setWidths(f);
            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.addCell("1.3", new Point(1,3));
            aTable.addCell("5.2", new Point(5,2));
            aTable.addCell("6.1", new Point(6,1));
            aTable.addCell("5.0", new Point(5,0));
            document.add(aTable);
      document.add(new Paragraph("converted to PdfPTable:"));
      aTable.setConvert2pdfptable(true);
      document.add(aTable);
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
View Full Code Here

          new GfrFileOutputStream("com.lowagie.examples.objects.tables.TableWidthAlignment.pdf"));
      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(3);
      LwgPdfPCell cell = new LwgPdfPCell(new Paragraph("header with colspan 3"));
      cell.setColspan(3);
      table.add(cell);
      table.add("1.1");
      table.add("2.1");
      table.add("3.1");
      table.add("1.2");
      table.add("2.2");
      table.add("3.2");
      cell = new LwgPdfPCell(new Paragraph("cell test1"));
      cell.setBorderColor(new Color(255, 0, 0));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("cell test2"));
      cell.setColspan(2);
      cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
      table.add(cell);
      document.add(table);
      table.setWidthPercentage(100);
View Full Code Here

      fonts[11] = new LwgFont(LwgFont.TIMES_ROMAN, LwgFont.DEFAULTSIZE, LwgFont.BOLDITALIC);
      fonts[12] = new LwgFont(LwgFont.SYMBOL);
      fonts[13] = new LwgFont(LwgFont.ZAPFDINGBATS);
      // add the content
      for (int i = 0; i < 14; i++) {
        document.add(new Paragraph("quick brown fox jumps over the lazy dog", fonts[i]));
      }
    } catch (DocumentException de) {
      System.err.println(de.getMessage());
    } catch (IOException ioe) {
      System.err.println(ioe.getMessage());
View Full Code Here

           
            // step 4: we add content to the document
            BaseFont bfComic = BaseFont.createFont("c:\\windows\\fonts\\comicbd.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
            LwgFont font = new LwgFont(bfComic, 12);
            String text1 = "This is the quite popular True Type font 'Comic'.";
            document.add(new Paragraph(text1, font));
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
        catch(IOException ioe) {
View Full Code Here

            // step 4
            String all[] = {"Symbol", "ZapfDingbats"};
            LwgFont hex = new LwgFont(LwgFont.HELVETICA, 5);
            for (int z = 0; z < all.length; ++z) {
                String file = all[z];
                document.add(new Paragraph("Unicode equivalence for the font \""
                    + file
            +"\" with the encoding \""
            +file
            + "\"\n"));
                char tb[];
View Full Code Here

            document.addHeader("Expires", "0");
            // meta information that will be in a comment section in HTML
            document.addCreator("My program using iText");
      document.open();
      // step 4: we add a paragraph to the document
      document.add(new Paragraph("Hello World"));
    } catch (DocumentException de) {
      System.err.println(de.getMessage());
    } catch (IOException ioe) {
      System.err.println(ioe.getMessage());
    }
View Full Code Here

            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("spacewordratio.pdf"));
            // step 3
            document.open();
            // step 4
            String text = "Flanders International Filmfestival Ghent - Internationaal Filmfestival van Vlaanderen Gent";
            Paragraph p = new Paragraph(text);
            p.setAlignment(LwgElement.ALIGN_JUSTIFIED);
            document.add(p);
            document.newPage();
            writer.setSpaceCharRatio(PdfWriter.NO_SPACE_CHAR_RATIO);
            document.add(p);
        }
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.