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 an x,y coordinate with a zoom setting.
24 * The default x,y,z will be whatever is the current value in the viewer application and
27 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
28 * @version $Revision: 1.2 $
30 public class PDPageXYZDestination extends PDPageDestination
33 * The type of this destination.
35 protected static final String TYPE = "XYZ";
38 * Default constructor.
41 public PDPageXYZDestination()
45 array.setName( 1, TYPE );
50 * Constructor from an existing destination array.
52 * @param arr The destination array.
54 public PDPageXYZDestination( COSArray arr )
60 * Get the left x coordinate. A return value of -1 implies that the current x-coordinate
63 * @return The left x coordinate.
67 return array.getInt( 2 );
71 * Set the left x-coordinate, a value of -1 implies that the current x-coordinate
73 * @param x The left x coordinate.
75 public void setLeft( int x )
77 array.growToSize( 3 );
80 array.set( 2, (COSBase)null );
89 * Get the top y coordinate. A return value of -1 implies that the current y-coordinate
92 * @return The top y coordinate.
96 return array.getInt( 3 );
100 * Set the top y-coordinate, a value of -1 implies that the current y-coordinate
102 * @param y The top ycoordinate.
104 public void setTop( int y )
106 array.growToSize( 4 );
109 array.set( 3, (COSBase)null );
113 array.setInt( 3, y );
118 * Get the zoom value. A return value of -1 implies that the current zoom
121 * @return The zoom value for the page.
125 return array.getInt( 4 );
129 * Set the zoom value for the page, a value of -1 implies that the current zoom
131 * @param zoom The zoom value.
133 public void setZoom( int zoom )
135 array.growToSize( 5 );
138 array.set( 4, (COSBase)null );
142 array.setInt( 4, zoom );