2
* $Id: PdfDestination.java,v 1.54 2005/05/04 14:33:11 blowagie Exp $
5
* Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* (the "License"); you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
11
* Software distributed under the License is distributed on an "AS IS" basis,
12
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
* for the specific language governing rights and limitations under the License.
15
* The Original Code is 'iText, a free JAVA-PDF library'.
17
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
18
* the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
19
* All Rights Reserved.
20
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
21
* are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
23
* Contributor(s): all the names of the contributors are added in the source code
26
* Alternatively, the contents of this file may be used under the terms of the
27
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
28
* provisions of LGPL are applicable instead of those above. If you wish to
29
* allow use of your version of this file only under the terms of the LGPL
30
* License and not to allow others to use your version of this file under
31
* the MPL, indicate your decision by deleting the provisions above and
32
* replace them with the notice and other provisions required by the LGPL.
33
* If you do not delete the provisions above, a recipient may use your version
34
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
36
* This library is free software; you can redistribute it and/or modify it
37
* under the terms of the MPL as stated above or under the terms of the GNU
38
* Library General Public License as published by the Free Software Foundation;
39
* either version 2 of the License, or any later version.
41
* This library is distributed in the hope that it will be useful, but WITHOUT
42
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
43
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
46
* If you didn't download this code from the following link, you should check if
47
* you aren't using an obsolete version:
48
* http://www.lowagie.com/iText/
51
package com.lowagie.text.pdf;
54
* A <CODE>PdfColor</CODE> defines a Color (it's a <CODE>PdfArray</CODE> containing 3 values).
59
public class PdfDestination extends PdfArray {
61
// public static final member-variables
63
/** This is a possible destination type */
64
public static final int XYZ = 0;
66
/** This is a possible destination type */
67
public static final int FIT = 1;
69
/** This is a possible destination type */
70
public static final int FITH = 2;
72
/** This is a possible destination type */
73
public static final int FITV = 3;
75
/** This is a possible destination type */
76
public static final int FITR = 4;
78
/** This is a possible destination type */
79
public static final int FITB = 5;
81
/** This is a possible destination type */
82
public static final int FITBH = 6;
84
/** This is a possible destination type */
85
public static final int FITBV = 7;
89
/** Is the indirect reference to a page already added? */
90
private boolean status = false;
95
* Constructs a new <CODE>PdfDestination</CODE>.
97
* If <VAR>type</VAR> equals <VAR>FITB</VAR>, the bounding box of a page
98
* will fit the window of the Reader. Otherwise the type will be set to
99
* <VAR>FIT</VAR> so that the entire page will fit to the window.
101
* @param type The destination type
104
public PdfDestination(int type) {
115
* Constructs a new <CODE>PdfDestination</CODE>.
117
* If <VAR>type</VAR> equals <VAR>FITBH</VAR> / <VAR>FITBV</VAR>,
118
* the width / height of the bounding box of a page will fit the window
119
* of the Reader. The parameter will specify the y / x coordinate of the
120
* top / left edge of the window. If the <VAR>type</VAR> equals <VAR>FITH</VAR>
121
* or <VAR>FITV</VAR> the width / height of the entire page will fit
122
* the window and the parameter will specify the y / x coordinate of the
123
* top / left edge. In all other cases the type will be set to <VAR>FITH</VAR>.
125
* @param type the destination type
126
* @param parameter a parameter to combined with the destination type
129
public PdfDestination(int type, float parameter) {
130
super(new PdfNumber(parameter));
133
addFirst(PdfName.FITH);
136
addFirst(PdfName.FITV);
139
addFirst(PdfName.FITBH);
142
addFirst(PdfName.FITBV);
146
/** Constructs a new <CODE>PdfDestination</CODE>.
148
* Display the page, with the coordinates (left, top) positioned
149
* at the top-left corner of the window and the contents of the page magnified
150
* by the factor zoom. A negative value for any of the parameters left or top, or a
151
* zoom value of 0 specifies that the current value of that parameter is to be retained unchanged.
152
* @param type must be a <VAR>PdfDestination.XYZ</VAR>
153
* @param left the left value. Negative to place a null
154
* @param top the top value. Negative to place a null
155
* @param zoom The zoom factor. A value of 0 keeps the current value
158
public PdfDestination(int type, float left, float top, float zoom) {
161
add(PdfNull.PDFNULL);
163
add(new PdfNumber(left));
165
add(PdfNull.PDFNULL);
167
add(new PdfNumber(top));
168
add(new PdfNumber(zoom));
171
/** Constructs a new <CODE>PdfDestination</CODE>.
173
* Display the page, with its contents magnified just enough
174
* to fit the rectangle specified by the coordinates left, bottom, right, and top
175
* entirely within the window both horizontally and vertically. If the required
176
* horizontal and vertical magnification factors are different, use the smaller of
177
* the two, centering the rectangle within the window in the other dimension.
179
* @param type must be PdfDestination.FITR
180
* @param left a parameter
181
* @param bottom a parameter
182
* @param right a parameter
183
* @param top a parameter
187
public PdfDestination(int type, float left, float bottom, float right, float top) {
189
add(new PdfNumber(left));
190
add(new PdfNumber(bottom));
191
add(new PdfNumber(right));
192
add(new PdfNumber(top));
198
* Checks if an indirect reference to a page has been added.
200
* @return <CODE>true</CODE> or <CODE>false</CODE>
203
public boolean hasPage() {
207
/** Adds the indirect reference of the destination page.
209
* @param page an indirect reference
210
* @return true if the page reference was added
213
public boolean addPage(PdfIndirectReference page) {
b'\\ No newline at end of file'