File: RtfPageNumber.java

package info (click to toggle)
libitext1-java 1.4-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 7,636 kB
  • sloc: java: 86,865; xml: 396; makefile: 15
file content (83 lines) | stat: -rw-r--r-- 2,161 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * Created on Aug 10, 2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package com.lowagie.text.rtf.field;

import java.io.IOException;

import com.lowagie.text.Font;
import com.lowagie.text.rtf.document.RtfDocument;


/**
 * The RtfPageNumber provides the page number field in rtf documents.
 * 
 * @version $Revision: 1.7 $
 * @author Mark Hall (mhall@edu.uni-klu.ac.at)
 * @author <a href="mailto:Steffen.Stundzig@smb-tec.com">Steffen.Stundzig@smb-tec.com</a>
 */
public class RtfPageNumber extends RtfField {

    /**
     * Constant for the page number
     */
    private static final byte[] PAGE_NUMBER = "PAGE".getBytes();
    
    /**
     * Constructs a RtfPageNumber. This can be added anywhere to add a page number field.
     */
    public RtfPageNumber() {
        super(null);
    }
    
    /**
     * Constructs a RtfPageNumber with a specified Font. This can be added anywhere to
     * add a page number field.
     * @param font
     */
    public RtfPageNumber(Font font) {
        super(null, font);
    }
    
    /**
     * Constructs a RtfPageNumber object.
     * 
     * @param doc The RtfDocument this RtfPageNumber belongs to
     */
    public RtfPageNumber(RtfDocument doc) {
        super(doc);
    }
    
    /**
     * Constructs a RtfPageNumber object with a specific font.
     * 
     * @param doc The RtfDocument this RtfPageNumber belongs to
     * @param font The Font to use
     */
    public RtfPageNumber(RtfDocument doc, Font font) {
        super(doc, font);
    }
    
    /**
     * Writes the field instruction content
     * 
     * @return A byte array containing "PAGE"
     * @throws IOException
     */
    protected byte[] writeFieldInstContent() throws IOException {
        return PAGE_NUMBER;
    }

    /**
     * Writes the field result content
     * 
     * @return An empty byte array
     * @throws IOException
     */
    protected byte[] writeFieldResultContent() throws IOException {
        return new byte[0];
    }
}