Examples of RtfHeaderFooter


Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            Table headerTable = new Table(3);
            headerTable.addCell("Test Cell 1");
            headerTable.addCell("Test Cell 2");
            headerTable.addCell("Test Cell 3");
            HeaderFooter header = new RtfHeaderFooter(headerTable);
            RtfHeaderFooterGroup footer = new RtfHeaderFooterGroup();
            footer
                    .setHeaderFooter(
                            new RtfHeaderFooter(new LwgPhrase(
                                    "This is the footer on the title page")),
                            com.lowagie.text.rtf.headerfooter.RtfHeaderFooter.DISPLAY_FIRST_PAGE);
            footer
                    .setHeaderFooter(
                            new RtfHeaderFooter(new LwgPhrase(
                                    "This is a left side page")),
                            com.lowagie.text.rtf.headerfooter.RtfHeaderFooter.DISPLAY_LEFT_PAGES);
            footer
                    .setHeaderFooter(
                            new RtfHeaderFooter(new LwgPhrase(
                                    "This is a right side page")),
                            com.lowagie.text.rtf.headerfooter.RtfHeaderFooter.DISPLAY_RIGHT_PAGES);

            doc.setHeader(header);
            doc.setFooter(footer);
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            date.setAlignment(Paragraph.ALIGN_RIGHT);
            Paragraph address = new Paragraph("TheFirm\nTheRoad 24, TheCity\n" +
                    "+00 99 11 22 33 44");

            // Create the RtfHeaderFooter with an array containing the Paragraphs to add
            RtfHeaderFooter header = new RtfHeaderFooter(new LwgElement[]{date, address});
           
            // Set the header
            document.setHeader(header);

            // Create the table that will be used as the footer
            Table footer = new Table(2);
            footer.setBorder(0);
            footer.getDefaultCell().setBorder(0);
            footer.setWidth(100);
            footer.addCell(new LwgCell("(c) Mark Hall"));
            Paragraph pageNumber = new Paragraph("Page ");
           
            // The RtfPageNumber is an RTF specific element that adds a page number field
            pageNumber.add(new RtfPageNumber());
            pageNumber.setAlignment(Paragraph.ALIGN_RIGHT);
            footer.addCell(new LwgCell(pageNumber));
           
            // Create the RtfHeaderFooter and set it as the footer to use
            document.setFooter(new RtfHeaderFooter(footer));
           
            document.open();
           
            document.add(new Paragraph("This document has headers and footers created" +
                    " using the RtfHeaderFooter class."));
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            // 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);
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            // Create the RtfHeaderFooterGroup for the header.
            // To display the same header on both pages, but not the
            // title page set them to left and right pages explicitly.
            RtfHeaderFooterGroup header = new RtfHeaderFooterGroup();
            header.setHeaderFooter(new RtfHeaderFooter(date), RtfHeaderFooter.DISPLAY_LEFT_PAGES);
            header.setHeaderFooter(new RtfHeaderFooter(date), RtfHeaderFooter.DISPLAY_RIGHT_PAGES);
           
            // Set the header
            document.setHeader(header);

            // Create the paragraphs that will be used as footers
            Paragraph titleFooter = new Paragraph("Multiple headers / footers example");
            titleFooter.setAlignment(LwgElement.ALIGN_CENTER);
            Paragraph leftFooter = new Paragraph("Page ");
            leftFooter.add(new RtfPageNumber());
            Paragraph rightFooter = new Paragraph("Page ");
            rightFooter.add(new RtfPageNumber());
            rightFooter.setAlignment(LwgElement.ALIGN_RIGHT);
           
            // Create the RtfHeaderGroup for the footer and set the footers
            // at the desired positions
            RtfHeaderFooterGroup footer = new RtfHeaderFooterGroup();
            footer.setHeaderFooter(new RtfHeaderFooter(titleFooter), RtfHeaderFooter.DISPLAY_FIRST_PAGE);
            footer.setHeaderFooter(new RtfHeaderFooter(leftFooter), RtfHeaderFooter.DISPLAY_LEFT_PAGES);
            footer.setHeaderFooter(new RtfHeaderFooter(rightFooter), RtfHeaderFooter.DISPLAY_RIGHT_PAGES);
           
            // Set the document footer
            document.setFooter(footer);
           
            document.open();
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            // Add the RtfPageNumber to the Paragraph
            par.add(new RtfPageNumber());
           
            // Create an RtfHeaderFooter with the Paragraph and set it
            // as a footer for the document
            RtfHeaderFooter footer = new RtfHeaderFooter(par);
            document.setFooter(footer);
           
            document.open();

            for(int i = 1; i <= 300; i++) {
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            par.add(" of ");
            par.add(new RtfTotalPageNumber());
           
            // Create an RtfHeaderFooter with the Paragraph and set it
            // as a header for the document
            RtfHeaderFooter header = new RtfHeaderFooter(par);
            document.setHeader(header);
           
            document.open();

            for(int i = 1; i <= 300; i++) {
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            // Add the RtfPageNumber to the Paragraph
            par.add(new RtfPageNumber());
           
            // Create an RtfHeaderFooter with the Paragraph and set it
            // as a footer for the document
            RtfHeaderFooter footer = new RtfHeaderFooter(par);
            document.setFooter(footer);
           
            document.open();

            for(int i = 1; i <= 300; i++) {
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            par.add(" of ");
            par.add(new RtfTotalPageNumber());
           
            // Create an RtfHeaderFooter with the Paragraph and set it
            // as a header for the document
            RtfHeaderFooter header = new RtfHeaderFooter(par);
            document.setHeader(header);
           
            document.open();

            for(int i = 1; i <= 300; i++) {
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            date.setAlignment(Paragraph.ALIGN_RIGHT);
            Paragraph address = new Paragraph("TheFirm\nTheRoad 24, TheCity\n" +
                    "+00 99 11 22 33 44");

            // Create the RtfHeaderFooter with an array containing the Paragraphs to add
            RtfHeaderFooter header = new RtfHeaderFooter(new Element[]{date, address});
           
            // Set the header
            document.setHeader(header);

            // Create the table that will be used as the footer
            Table footer = new Table(2);
            footer.setBorder(0);
            footer.getDefaultCell().setBorder(0);
            footer.setWidth(100);
            footer.addCell(new Cell("(c) Mark Hall"));
            Paragraph pageNumber = new Paragraph("Page ");
           
            // The RtfPageNumber is an RTF specific element that adds a page number field
            pageNumber.add(new RtfPageNumber());
            pageNumber.setAlignment(Paragraph.ALIGN_RIGHT);
            footer.addCell(new Cell(pageNumber));
           
            // Create the RtfHeaderFooter and set it as the footer to use
            document.setFooter(new RtfHeaderFooter(footer));
           
            document.open();
           
            document.add(new Paragraph("This document has headers and footers created" +
                    " using the RtfHeaderFooter class."));
View Full Code Here

Examples of com.lowagie.text.rtf.headerfooter.RtfHeaderFooter

            // 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(Element.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 Phrase("This is page "), new Phrase(".")));
           
            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(Element.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(Element.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);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.