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