Package com.lowagie.text

Examples of com.lowagie.text.Paragraph


            document.open();
           
            // Simply set the stylesheet you wish to use as the Font
            // of the Paragraph
            document.add(new Paragraph("This is a heading level 1",
                    RtfParagraphStyle.STYLE_HEADING_1));
            document.add(new Paragraph("This is a heading level 2",
                    RtfParagraphStyle.STYLE_HEADING_2));
            document.add(new Paragraph("Just some text that is formatted " +
                    "in the default style.", RtfParagraphStyle.STYLE_NORMAL));

            document.close();
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
View Full Code Here


            RtfWriter2.getInstance(document, new FileOutputStream("BasicTabs.rtf"));

            document.open();
           
            // Define the Paragraph to add tab stops to
            Paragraph par = new Paragraph();
           
            // Add the tab stops to the paragraph
            par.add(new RtfTab(70, RtfTab.TAB_LEFT_ALIGN));
            par.add(new RtfTab(400, RtfTab.TAB_RIGHT_ALIGN));
           
            // Add the text to the paragraph, placing the tab stops with \t
            par.add("\tFirst the text on the left-hand side\tThis text is right aligned.");
           
            document.add(par);

            document.close();
        } catch (FileNotFoundException fnfe) {
View Full Code Here

            FontSelector sel = new FontSelector();
            sel.addFont(new LwgFont(LwgFont.TIMES_ROMAN, 12));
            sel.addFont(new LwgFont(LwgFont.ZAPFDINGBATS, 12));
            sel.addFont(new LwgFont(LwgFont.SYMBOL, 12));
            LwgPhrase ph = sel.process(text);
            document.add(new Paragraph(ph));
            // step 5
            document.close();
        }
        catch(Exception de) {
            de.printStackTrace();
View Full Code Here

      writer5.setViewerPreferences(PdfWriter.PrintScalingNone);
      document.addTitle("Julius Caesar");
      document.open();
      // step 4: we grab the ContentByte and do some stuff with it
      document
          .add(new Paragraph(
              "GALLIA est omnis divisa in partes tres, quarum unam incolunt Belgae, aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur.  Hi omnes lingua, institutis, legibus inter se differunt. Gallos ab Aquitanis Garumna flumen, a Belgis Matrona et Sequana dividit. Horum omnium fortissimi sunt Belgae, propterea quod a cultu atque humanitate provinciae longissime absunt, minimeque ad eos mercatores saepe commeant atque ea quae ad effeminandos animos pertinent important, proximique sunt Germanis, qui trans Rhenum incolunt, quibuscum continenter bellum gerunt.  Qua de causa Helvetii quoque reliquos Gallos virtute praecedunt, quod fere cotidianis proeliis cum Germanis contendunt, cum aut suis finibus eos prohibent aut ipsi in eorum finibus bellum gerunt.",
              new LwgFont(LwgFont.HELVETICA, 12)));
      document
          .add(new Paragraph(
              "[Eorum una, pars, quam Gallos obtinere dictum est, initium capit a flumine Rhodano, continetur Garumna flumine, Oceano, finibus Belgarum, attingit etiam ab Sequanis et Helvetiis flumen Rhenum, vergit ad septentriones. Belgae ab extremis Galliae finibus oriuntur, pertinent ad inferiorem partem fluminis Rheni, spectant in septentrionem et orientem solem. Aquitania a Garumna flumine ad Pyrenaeos montes et eam partem Oceani quae est ad Hispaniam pertinet; spectat inter occasum solis et septentriones.]",
              new LwgFont(LwgFont.HELVETICA, 12)));
      document
          .add(new Paragraph(
              "Apud Helvetios longe nobilissimus fuit et ditissimus Orgetorix.  Is M. Messala, [et P.] M.  Pisone consulibus regni cupiditate inductus coniurationem nobilitatis fecit et civitati persuasit ut de finibus suis cum omnibus copiis exirent:  perfacile esse, cum virtute omnibus praestarent, totius Galliae imperio potiri.  Id hoc facilius iis persuasit, quod undique loci natura Helvetii continentur:  una ex parte flumine Rheno latissimo atque altissimo, qui agrum Helvetium a Germanis dividit; altera ex parte monte Iura altissimo, qui est inter Sequanos et Helvetios; tertia lacu Lemanno et flumine Rhodano, qui provinciam nostram ab Helvetiis dividit.  His rebus fiebat ut et minus late vagarentur et minus facile finitimis bellum inferre possent; qua ex parte homines bellandi cupidi magno dolore adficiebantur.  Pro multitudine autem hominum et pro gloria belli atque fortitudinis angustos se fines habere arbitrabantur, qui in longitudinem milia passuum CCXL, in latitudinem CLXXX patebant.",
              new LwgFont(LwgFont.HELVETICA, 12)));
      document
          .add(new Paragraph(
              "His rebus adducti et auctoritate Orgetorigis permoti constituerunt ea quae ad proficiscendum pertinerent comparare, iumentorum et carrorum quam maximum numerum coemere, sementes quam maximas facere, ut in itinere copia frumenti suppeteret, cum proximis civitatibus pacem et amicitiam confirmare.  Ad eas res conficiendas biennium sibi satis esse duxerunt; in tertium annum profectionem lege confirmant.  Ad eas res conficiendas Orgetorix deligitur.  Is sibi legationem ad civitates suscipit.  In eo itinere persuadet Castico, Catamantaloedis filio, Sequano, cuius pater regnum in Sequanis multos annos obtinuerat et a senatu populi Romani amicus appellatus erat, ut regnum in civitate sua occuparet, quod pater ante habuerit; itemque Dumnorigi Haeduo, fratri Diviciaci, qui eo tempore principatum in civitate obtinebat ac maxime plebi acceptus erat, ut idem conaretur persuadet eique filiam suam in matrimonium dat.  Perfacile factu esse illis probat conata perficere, propterea quod ipse suae civitatis imperium obtenturus esset:  non esse dubium quin totius Galliae plurimum Helvetii possent; se suis copiis suoque exercitu illis regna conciliaturum confirmat.  Hac oratione adducti inter se fidem et ius iurandum dant et regno occupato per tres potentissimos ac firmissimos populos totius Galliae sese potiri posse sperant.",
              new LwgFont(LwgFont.HELVETICA, 12)));
      document
          .add(new Paragraph(
              "Ea res est Helvetiis per indicium enuntiata.  Moribus suis Orgetoricem ex vinculis causam dicere coegerunt; damnatum poenam sequi oportebat, ut igni cremaretur.  Die constituta causae dictionis Orgetorix ad iudicium omnem suam familiam, ad hominum milia decem, undique coegit, et omnes clientes obaeratosque suos, quorum magnum numerum habebat, eodem conduxit; per eos ne causam diceret se eripuit.  Cum civitas ob eam rem incitata armis ius suum exequi conaretur multitudinemque hominum ex agris magistratus cogerent, Orgetorix mortuus est; neque abest suspicio, ut Helvetii arbitrantur, quin ipse sibi mortem consciverit.",
              new LwgFont(LwgFont.HELVETICA, 12)));
    } catch (Exception de) {
      de.printStackTrace();
    }
View Full Code Here

           
            document.open();
           
            // Simply set the stylesheet you wish to use as the Font
            // of the Paragraph
            document.add(new Paragraph("This is a heading level 1",
                    RtfParagraphStyle.STYLE_HEADING_1));
            document.add(new Paragraph("This is a heading level 2",
                    RtfParagraphStyle.STYLE_HEADING_2));
            document.add(new Paragraph("Just some text that is formatted " +
                    "in the default style.", RtfParagraphStyle.STYLE_NORMAL));
            document.add(new Paragraph("This paragraph should be removed.",
                    incorrectStyle));
            document.add(new Paragraph("It should be replaced with this.",
                    correctStyle));

            document.close();
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
View Full Code Here

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

            // Create the header identifying the current chapter. The first
            // chapter has to be set before the document is opened.
            Paragraph header = new Paragraph("Chapter 1");
            header.setAlignment(LwgElement.ALIGN_CENTER);
            document.setHeader(new RtfHeaderFooter(header));
           
            // If the footer (or header) is to be the same for all Chapters
            // then it has to be set before the document is opened and is
            // then automatically set for all Chapters.
            document.setFooter(new HeaderFooter(new LwgPhrase("This is page "), new LwgPhrase(".")));
           
            document.open();
           
            Chapter chapter1 = new Chapter("Chapter 1", 1);
            chapter1.add(new Paragraph("This document has different headers and footers " +
                    " for each chapter."));
            document.add(chapter1);

            // After adding the first chapter set the header for the second chapter.
            header = new Paragraph("Chapter 2");
            header.setAlignment(LwgElement.ALIGN_CENTER);
            document.setHeader(new RtfHeaderFooter(header));

            Chapter chapter2 = new Chapter("Chapter 2", 2);
            chapter2.add(new Paragraph("This is the content of chapter 2."));
            document.add(chapter2);
           
            // After adding the second chapter set the header for the third chapter.
            header = new Paragraph("Chapter 3");
            header.setAlignment(LwgElement.ALIGN_CENTER);
            document.setHeader(new RtfHeaderFooter(header));

            Chapter chapter3 = new Chapter("Chapter 3", 3);
            chapter3.add(new Paragraph("Chapter 3 is very boring."));
            document.add(chapter3);

            document.close();
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
View Full Code Here

            rtfWriter2.getDocumentSettings().registerParagraphStyle(tocLevel2Style);
           
            document.open();

            // Create a Paragraph and add the table of contents to it
            Paragraph par = new Paragraph();
            par.add(new RtfTableOfContents("Right-click here and select \"Update\" " +
                    "to see the table of contents."));
            document.add(par);
           
            for(int i = 1; i <= 5; i++) {
                // Create a level 1 heading
                document.add(new Paragraph("Heading " + i, RtfParagraphStyle.STYLE_HEADING_1));
                for(int j = 1; j <= 3; j++) {
                    // Create a level 2 heading
                    document.add(new Paragraph("Heading " + i + "." + j, RtfParagraphStyle.STYLE_HEADING_2));
                    for(int k = 1; k <= 20; k++) {
                        document.add(new Paragraph("Line " + k + " in section " + i + "." + k));
                    }
                }
            }
           
            document.close();
View Full Code Here

      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(2);
      LwgPdfPCell cell;
      Paragraph p = new Paragraph("Quick brown fox jumps over the lazy dog. Quick brown fox jumps over the lazy dog.");
      table.add("default alignment");
      cell = new LwgPdfPCell(p);
      table.add(cell);
      table.add("centered alignment");
      cell = new LwgPdfPCell(p);
View Full Code Here

            table.addCell("1.2");
            table.addCell("2.2");
            table.addCell("3.2");
            document.add(table);
            table.setConvert2pdfptable(true);
      document.add(new Paragraph("converted to PdfPTable:"));
            document.add(table);
           
            table = new Table(3);
            table.setBorderWidth(3);
            table.setBorderColor(new Color(255, 0, 0));
            table.setPadding(0);
            cell = new LwgCell("header");
            cell.setHeader(true);
            cell.setBorderColorBottom(new Color(0, 0, 255));
            cell.setColspan(3);
            table.addCell(cell);
            table.addCell("1.1");
            cell = new LwgCell("2.1");
            cell.setBorderWidthLeft(4);
            cell.setBorderWidthRight(8);
            cell.setBorderWidthTop(2);
            cell.setBorderWidthBottom(10);
            cell.setUseBorderPadding(true);
            cell.setBorderColorBottom(new Color(0, 255, 0));
            table.addCell(cell);
            table.addCell("3.1");
            table.addCell("1.2");
            table.addCell("2.2");
            table.addCell("3.2");
            document.add(table);
            table.setConvert2pdfptable(true);
      document.add(new Paragraph("converted to PdfPTable:"));
            document.add(table);
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
View Full Code Here

    this.onOpenGroup()// event handler
   
    if(this.rtfParser.isImport()) {
    }
    if(this.rtfParser.isConvert()) {
      if(this.iTextParagraph == null) this.iTextParagraph = new Paragraph();
    }
    return true;
  }
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.