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
22 * This represents a destination to a page and the page contents will be magnified to just
\r
23 * fit on the screen.
\r
25 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
\r
26 * @version $Revision: 1.2 $
\r
28 public class PDPageFitDestination extends PDPageDestination
\r
31 * The type of this destination.
\r
33 protected static final String TYPE = "Fit";
\r
35 * The type of this destination.
\r
37 protected static final String TYPE_BOUNDED = "FitB";
\r
40 * Default constructor.
\r
43 public PDPageFitDestination()
\r
46 array.growToSize(2);
\r
47 array.setName( 1, TYPE );
\r
52 * Constructor from an existing destination array.
\r
54 * @param arr The destination array.
\r
56 public PDPageFitDestination( COSArray arr )
\r
62 * A flag indicating if this page destination should just fit bounding box of the PDF.
\r
64 * @return true If the destination should fit just the bounding box.
\r
66 public boolean fitBoundingBox()
\r
68 return TYPE_BOUNDED.equals( array.getName( 1 ) );
\r
72 * Set if this page destination should just fit the bounding box. The default is false.
\r
74 * @param fitBoundingBox A flag indicating if this should fit the bounding box.
\r
76 public void setFitBoundingBox( boolean fitBoundingBox )
\r
78 array.growToSize( 2 );
\r
79 if( fitBoundingBox )
\r
81 array.setName( 1, TYPE_BOUNDED );
\r
85 array.setName( 1, TYPE );
\r