KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lowagie > text > rtf > RtfPageNumber


1 /**
2  * $Id: RtfPageNumber.java 2623 2007-02-23 22:28:28Z xlv $
3  *
4  * Copyright 2002 by
5  * <a HREF="http://www.smb-tec.com">SMB</a>
6  * Steffen.Stundzig (Steffen.Stundzig@smb-tec.com)
7  *
8  * The contents of this file are subject to the Mozilla Public License Version 1.1
9  * (the "License"); you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the License.
15  *
16  * The Original Code is 'iText, a free JAVA-PDF library'.
17  *
18  * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
19  * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
20  * All Rights Reserved.
21  * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
22  * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
23  *
24  * Contributor(s): all the names of the contributors are added in the source code
25  * where applicable.
26  *
27  * Alternatively, the contents of this file may be used under the terms of the
28  * LGPL license (the ?GNU LIBRARY GENERAL PUBLIC LICENSE?), in which case the
29  * provisions of LGPL are applicable instead of those above. If you wish to
30  * allow use of your version of this file only under the terms of the LGPL
31  * License and not to allow others to use your version of this file under
32  * the MPL, indicate your decision by deleting the provisions above and
33  * replace them with the notice and other provisions required by the LGPL.
34  * If you do not delete the provisions above, a recipient may use your version
35  * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
36  *
37  * This library is free software; you can redistribute it and/or modify it
38  * under the terms of the MPL as stated above or under the terms of the GNU
39  * Library General Public License as published by the Free Software Foundation;
40  * either version 2 of the License, or any later version.
41  *
42  * This library is distributed in the hope that it will be useful, but WITHOUT
43  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
44  * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
45  * details.
46  *
47  * If you didn't download this code from the following link, you should check if
48  * you aren't using an obsolete version:
49  * http://www.lowagie.com/iText/
50  */

51
52 package com.lowagie.text.rtf;
53
54 import java.io.IOException JavaDoc;
55 import java.io.OutputStream JavaDoc;
56
57 import com.lowagie.text.Font;
58
59 /**
60  * A rtf page number field.
61  *
62  * ONLY FOR USE WITH THE RtfWriter NOT with the RtfWriter2.
63  *
64  * This class is based on the RtfWriter-package from Mark Hall.
65  * @author Steffen.Stundzig (Steffen.Stundzig@smb-tec.com)
66  * @author Mark Hall (mhall@edu.uni-klu.ac.at)
67  * @version $Revision: 2623 $Date: 2006/09/12 13:12:54 $
68  * @deprecated Please move to the RtfWriter2 and associated classes. com.lowagie.text.rtf.field.RtfPageNumber replaces the functionality of this class.
69  */

70 public class RtfPageNumber extends GenericRtfField {
71     private String JavaDoc content;
72
73     /**
74      * construct a RtfPageNumber. The parameter content will be
75      * displayed in front of the page number using the font given as
76      * second argument.
77      * @param content the String that will be displayed in front of the page number
78      * @param contentFont the font to use to display this page number
79      */

80     public RtfPageNumber( String JavaDoc content, Font contentFont ) {
81         super("PAGE", "", contentFont);
82         this.content = content;
83     }
84
85     /**
86      * write this RtfField into a stream using the writer given as
87      * first argument.
88      * @param writer the RtfWriter to use to write this RtfField
89      * @param out the Stream to write this RtfField into.
90      * @throws IOException
91      */

92     public void write( RtfWriter writer, OutputStream JavaDoc out ) throws IOException JavaDoc {
93         writer.writeInitialFontSignature( out, this );
94         out.write(content.getBytes());
95         writer.writeFinishingFontSignature( out, this );
96         super.write(writer, out);
97     }
98
99     /**
100      * @see com.lowagie.text.Element#toString()
101      */

102     public String JavaDoc toString() {
103         return content;
104     }
105 }
106
Popular Tags