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 x location and the height 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 PDPageFitHeightDestination extends PDPageDestination
32 * The type of this destination.
34 protected static final String TYPE = "FitV";
36 * The type of this destination.
38 protected static final String TYPE_BOUNDED = "FitBV";
41 * Default constructor.
44 public PDPageFitHeightDestination()
48 array.setName( 1, TYPE );
53 * Constructor from an existing destination array.
55 * @param arr The destination array.
57 public PDPageFitHeightDestination( COSArray arr )
63 * Get the left x coordinate. A return value of -1 implies that the current x-coordinate
66 * @return The left x coordinate.
70 return array.getInt( 2 );
74 * Set the left x-coordinate, a value of -1 implies that the current x-coordinate
76 * @param x The left x coordinate.
78 public void setLeft( int x )
80 array.growToSize( 3 );
83 array.set( 2, (COSBase)null );
92 * A flag indicating if this page destination should just fit bounding box of the PDF.
94 * @return true If the destination should fit just the bounding box.
96 public boolean fitBoundingBox()
98 return TYPE_BOUNDED.equals( array.getName( 1 ) );
102 * Set if this page destination should just fit the bounding box. The default is false.
104 * @param fitBoundingBox A flag indicating if this should fit the bounding box.
106 public void setFitBoundingBox( boolean fitBoundingBox )
108 array.growToSize( 2 );
111 array.setName( 1, TYPE_BOUNDED );
115 array.setName( 1, TYPE );