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