2 * Licensed to the Apache Software Foundation (ASF) under one or more
\r
3 * contributor license agreements. See the NOTICE file distributed with
\r
4 * this work for additional information regarding copyright ownership.
\r
5 * The ASF licenses this file to You under the Apache License, Version 2.0
\r
6 * (the "License"); you may not use this file except in compliance with
\r
7 * the License. You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
17 package org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination;
\r
19 import org.apache.pdfbox.cos.COSArray;
\r
20 import org.apache.pdfbox.cos.COSBase;
\r
23 * This represents a destination to a page at a y location and the width is magnified
\r
24 * to just fit on the screen.
\r
26 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
\r
27 * @version $Revision: 1.2 $
\r
29 public class PDPageFitRectangleDestination extends PDPageDestination
\r
32 * The type of this destination.
\r
34 protected static final String TYPE = "FitR";
\r
37 * Default constructor.
\r
40 public PDPageFitRectangleDestination()
\r
43 array.growToSize(6);
\r
44 array.setName( 1, TYPE );
\r
49 * Constructor from an existing destination array.
\r
51 * @param arr The destination array.
\r
53 public PDPageFitRectangleDestination( COSArray arr )
\r
59 * Get the left x coordinate. A return value of -1 implies that the current x-coordinate
\r
62 * @return The left x coordinate.
\r
64 public int getLeft()
\r
66 return array.getInt( 2 );
\r
70 * Set the left x-coordinate, a value of -1 implies that the current x-coordinate
\r
72 * @param x The left x coordinate.
\r
74 public void setLeft( int x )
\r
76 array.growToSize( 3 );
\r
79 array.set( 2, (COSBase)null );
\r
83 array.setInt( 2, x );
\r
88 * Get the bottom y coordinate. A return value of -1 implies that the current y-coordinate
\r
91 * @return The bottom y coordinate.
\r
93 public int getBottom()
\r
95 return array.getInt( 3 );
\r
99 * Set the bottom y-coordinate, a value of -1 implies that the current y-coordinate
\r
101 * @param y The bottom y coordinate.
\r
103 public void setBottom( int y )
\r
105 array.growToSize( 6 );
\r
108 array.set( 3, (COSBase)null );
\r
112 array.setInt( 3, y );
\r
117 * Get the right x coordinate. A return value of -1 implies that the current x-coordinate
\r
120 * @return The right x coordinate.
\r
122 public int getRight()
\r
124 return array.getInt( 4 );
\r
128 * Set the right x-coordinate, a value of -1 implies that the current x-coordinate
\r
130 * @param x The right x coordinate.
\r
132 public void setRight( int x )
\r
134 array.growToSize( 6 );
\r
137 array.set( 4, (COSBase)null );
\r
141 array.setInt( 4, x );
\r
147 * Get the top y coordinate. A return value of -1 implies that the current y-coordinate
\r
150 * @return The top y coordinate.
\r
152 public int getTop()
\r
154 return array.getInt( 5 );
\r
158 * Set the top y-coordinate, a value of -1 implies that the current y-coordinate
\r
160 * @param y The top ycoordinate.
\r
162 public void setTop( int y )
\r
164 array.growToSize( 6 );
\r
167 array.set( 5, (COSBase)null );
\r
171 array.setInt( 5, y );
\r