org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination
abstract public class: PDPageDestination [javadoc |
source]
java.lang.Object
org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination
org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageDestination
All Implemented Interfaces:
PDDestinationOrAction
Direct Known Subclasses:
PDPageXYZDestination, PDPageFitWidthDestination, PDPageFitRectangleDestination, PDPageFitDestination, PDPageFitHeightDestination
This represents a destination to a page, see subclasses for specific parameters.
Field Summary |
---|
protected COSArray | array | Storage for the page destination. |
Methods from org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination: |
---|
create, toString |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageDestination Detail: |
public int findPageNumber() {
int retval = -1;
if( array.size() > 0 )
{
COSBase page = array.getObject( 0 );
if( page instanceof COSNumber )
{
retval = ((COSNumber)page).intValue();
}
else if (page instanceof COSDictionary)
{
COSBase parent = page;
while (((COSDictionary) parent).getDictionaryObject("Parent", "P") != null) {
parent = ((COSDictionary) parent).getDictionaryObject( "Parent", "P" );
}
// now parent is the pages node
PDPageNode pages = new PDPageNode((COSDictionary) parent);
List< PDPage > allPages = new ArrayList< PDPage >();
pages.getAllKids(allPages);
retval = allPages.indexOf(new PDPage((COSDictionary) page)) + 1;
}
}
return retval;
}
Returns the page number for this destination, regardless of whether
this is a page number or a reference to a page. |
public COSArray getCOSArray() {
return array;
}
Convert this standard java object to a COS object. |
public COSBase getCOSObject() {
return array;
}
Convert this standard java object to a COS object. |
public PDPage getPage() {
PDPage retval = null;
if( array.size() > 0 )
{
COSBase page = array.getObject( 0 );
if( page instanceof COSDictionary )
{
retval = new PDPage( (COSDictionary)page );
}
}
return retval;
}
This will get the page for this destination. A page destination
can either reference a page or a page number(when doing a remote destination to
another PDF). If this object is referencing by page number then this method will
return null and getPageNumber should be used. |
public int getPageNumber() {
int retval = -1;
if( array.size() > 0 )
{
COSBase page = array.getObject( 0 );
if( page instanceof COSNumber )
{
retval = ((COSNumber)page).intValue();
}
}
return retval;
}
This will get the page number for this destination. A page destination
can either reference a page or a page number(when doing a remote destination to
another PDF). If this object is referencing by page number then this method will
return that number, otherwise -1 will be returned. |
public void setPage(PDPage page) {
array.set( 0, page );
}
Set the page for this destination. |
public void setPageNumber(int pageNumber) {
array.set( 0, pageNumber );
}
Set the page number for this destination. |