Example usage for com.lowagie.text.rtf.field RtfPageNumber RtfPageNumber

List of usage examples for com.lowagie.text.rtf.field RtfPageNumber RtfPageNumber

Introduction

In this page you can find the example usage for com.lowagie.text.rtf.field RtfPageNumber RtfPageNumber.

Prototype

public RtfPageNumber(RtfDocument doc) 

Source Link

Document

Constructs a RtfPageNumber object.

Usage

From source file:io.vertigo.dynamo.plugins.export.rtf.RTFExporter.java

License:Apache License

/** {@inheritDoc} */
@Override// w w  w . j  a  v a  2s .c o  m
protected void createWriter(final Document document, final OutputStream out) {
    // final RtfWriter2 writer =
    RtfWriter2.getInstance(document, out);
    // writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft);

    // advanced page numbers : x/y
    final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL);
    //-----
    final Paragraph footerParagraph = new Paragraph();
    footerParagraph.add(new RtfPageNumber(font));
    footerParagraph.add(new Phrase(" / ", font));
    footerParagraph.add(new RtfTotalPageNumber(font));
    footerParagraph.setAlignment(Element.ALIGN_CENTER);
    //-----
    final HeaderFooter footer = new RtfHeaderFooter(footerParagraph);
    footer.setBorder(Rectangle.TOP);
    document.setFooter(footer);
}

From source file:io.vertigo.quarto.plugins.export.rtf.RTFExporter.java

License:Apache License

/** {@inheritDoc} */
@Override/*from w  w w. j a va  2  s.  co  m*/
protected void createWriter(final Document document, final OutputStream out) {
    RtfWriter2.getInstance(document, out);

    // advanced page numbers : x/y
    final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL);
    //-----
    final Paragraph footerParagraph = new Paragraph();
    footerParagraph.add(new RtfPageNumber(font));
    footerParagraph.add(new Phrase(" / ", font));
    footerParagraph.add(new RtfTotalPageNumber(font));
    footerParagraph.setAlignment(Element.ALIGN_CENTER);
    //-----
    final HeaderFooter footer = new RtfHeaderFooter(footerParagraph);
    footer.setBorder(Rectangle.TOP);
    document.setFooter(footer);
}

From source file:net.bull.javamelody.swing.print.MRtfWriter.java

License:Apache License

/**
 * We create a writer that listens to the document and directs a RTF-stream to out
 *
 * @param table/*from  w ww .  jav  a2  s  .c  om*/
 *           MBasicTable
 * @param document
 *           Document
 * @param out
 *           OutputStream
 * @return DocWriter
 */
@Override
protected DocWriter createWriter(final MBasicTable table, final Document document, final OutputStream out) {
    final RtfWriter2 writer = RtfWriter2.getInstance(document, out);

    // title
    final String title = buildTitle(table);
    if (title != null) {
        final HeaderFooter header = new RtfHeaderFooter(new Paragraph(title));
        header.setAlignment(Element.ALIGN_LEFT);
        header.setBorder(Rectangle.NO_BORDER);
        document.setHeader(header);
        document.addTitle(title);
    }

    // advanced page numbers : x/y
    final Paragraph footerParagraph = new Paragraph();
    final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL);
    footerParagraph.add(new RtfPageNumber(font));
    footerParagraph.add(new Phrase(" / ", font));
    footerParagraph.add(new RtfTotalPageNumber(font));
    footerParagraph.setAlignment(Element.ALIGN_CENTER);
    final HeaderFooter footer = new RtfHeaderFooter(footerParagraph);
    footer.setBorder(Rectangle.TOP);
    document.setFooter(footer);

    return writer;
}