Gnostice PDFOne
Pro. Ed. v5.0.0


com.gnostice.pdfone
Class PdfGotoAction

java.lang.Object
  extended bycom.gnostice.pdfone.PdfAction
      extended bycom.gnostice.pdfone.PdfGotoAction

public class PdfGotoAction
extends PdfAction

This class represents a "go-to" action. A go-to action makes a viewer application to change the current view to a specified destination.

PdfWriter writer1 = PdfWriter.fileWriter(
           new File("PdfGotoAction_example.pdf"));
PdfDocument doc1 = new PdfDocument(writer1);

// Create two PDF pages
PdfPage page1 = new PdfPage();
PdfPage page2 = (PdfPage) page1.clone();

// Render some text on the pages
page1.writeText("Click here to go to page 2", 200, 100);
page2.writeText("This is page 2");

// Create a link annotation over a word rendered on page 1
PdfLinkAnnot la = new PdfLinkAnnot(new PdfRect(223, 100, 23, 12), Color.BLUE);

// Create a go-to action for navigation into page 2
PdfGotoAction gta = new PdfGotoAction(2);

// Add the go-to action to the link annotation
la.addAction(gta);

// Add the link annotation to page 1
page1.addAnnotation(la);

doc1.add(page1);
doc1.add(page2);
doc1.setOpenAfterSave(true);
doc1.write();
writer1.dispose();


Nested Class Summary
 
Nested classes inherited from class com.gnostice.pdfone.PdfAction
PdfAction.PdfEvent
 
Field Summary
 
Fields inherited from class com.gnostice.pdfone.PdfAction
GOTO, JAVASCRIPT, LAUNCH, NAMED, NAMED_FIND, NAMED_FIRSTPAGE, NAMED_LASTPAGE, NAMED_NEXTPAGE, NAMED_OPEN, NAMED_PREVPAGE, NAMED_PRINT, NAMED_SEARCH, REMOTE_GOTO, URI
 
Constructor Summary
PdfGotoAction(int pageNo)
          Constructs a go-to action that changes the current view on the viewer application to specfied page.
PdfGotoAction(int pageNo, double left, double top, double zoom)
          Constructs a go-to action that changes the current view on the viewer application to position specfied by left and top on specified page.
PdfGotoAction(int pageNo, double x, double y, double width, double height)
          Constructs a go-to action that changes the current view on the viewer application to specified rectangular area on a specified page.
PdfGotoAction(int pageNo, double pos, int fit)
          Constructs a go-to action that changes the current view on the viewer application to position specfied by pos on specified page.
PdfGotoAction(int pageNo, int fit)
          Constructs a go-to action that changes the current view on the viewer application to specfied page and displays the page as specified by fit.
PdfGotoAction(int pageNo, PdfRect rect)
          Constructs a go-to action that changes the current view on the viewer application to specified rectangle on specified page.
 
Method Summary
 int getDestinationType()
          Returns destination type of the go-to action.
 int getFit()
           
 double getLeft()
           
 int getPageNo()
           
 double getPos()
           
 PdfRect getRect()
           
 double getTop()
           
 double getZoom()
           
 void setDestination(double left, double top, double zoom)
           
 void setDestination(double x, double y, double width, double height)
           
 void setDestination(double pos, int fit)
           
 void setDestination(int fit)
           
 void setDestination(PdfRect rect)
           
 void setPageNo(int pageNo)
           
 
Methods inherited from class com.gnostice.pdfone.PdfAction
getActionType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdfGotoAction

public PdfGotoAction(int pageNo)
Constructs a go-to action that changes the current view on the viewer application to specfied page.

Parameters:
pageNo - number of the page

PdfGotoAction

public PdfGotoAction(int pageNo,
                     double left,
                     double top,
                     double zoom)
Constructs a go-to action that changes the current view on the viewer application to position specfied by left and top on specified page.

Parameters:
pageNo - number of the page
left - x-coordinate of the top-left corner of the window on the page
top - y-coordinate of the top-left corner of the window on the page
zoom - magnification (zoom) factor to be applied when displaying the page

PdfGotoAction

public PdfGotoAction(int pageNo,
                     double x,
                     double y,
                     double width,
                     double height)
Constructs a go-to action that changes the current view on the viewer application to specified rectangular area on a specified page.

Parameters:
pageNo - number of the page
x - x-coordinate of the top-left corner of the rectangular area
y - y-coordinate of the top-left corner of the rectangular area
width - width of the rectangular area
height - height of the rectangular area

PdfGotoAction

public PdfGotoAction(int pageNo,
                     double pos,
                     int fit)
              throws PdfException
Constructs a go-to action that changes the current view on the viewer application to position specfied by pos on specified page.

Parameters:
pageNo - number of the destination page
pos - coordinates of top-left corner of the window on the page
fit - constant for specifying magnification (zoom) factor of the page
Throws:
PdfException - if an illegal argument is supplied.

PdfGotoAction

public PdfGotoAction(int pageNo,
                     int fit)
              throws PdfException
Constructs a go-to action that changes the current view on the viewer application to specfied page and displays the page as specified by fit.

Parameters:
pageNo - number of the destination page
fit - either PdfBookmark.FITB or PdfDestination.FIT
Throws:
PdfException - if an illegal argument is supplied.

PdfGotoAction

public PdfGotoAction(int pageNo,
                     PdfRect rect)
Constructs a go-to action that changes the current view on the viewer application to specified rectangle on specified page.

Parameters:
pageNo - number of the destination page
rect - rectangle on the page
Method Detail

setDestination

public void setDestination(double left,
                           double top,
                           double zoom)

setDestination

public void setDestination(double x,
                           double y,
                           double width,
                           double height)

setDestination

public void setDestination(double pos,
                           int fit)
                    throws PdfException
Throws:
PdfException

setDestination

public void setDestination(int fit)
                    throws PdfException
Throws:
PdfException

setDestination

public void setDestination(PdfRect rect)

getPageNo

public int getPageNo()

setPageNo

public void setPageNo(int pageNo)

getFit

public int getFit()

getLeft

public double getLeft()

getPos

public double getPos()

getTop

public double getTop()

getZoom

public double getZoom()

getRect

public PdfRect getRect()

getDestinationType

public int getDestinationType()
Returns destination type of the go-to action.

Returns:
constant specifying the destination type

Gnostice PDFOne
Pro. Ed. v5.0.0

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2010 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com