public class PdfPagePresentation extends Object implements Cloneable
// Create a PDF page
PdfPage page1 = new PdfPage(PdfPageSize.A4);
// Create a transition
PdfPagePresentation pp = new PdfPagePresentation();
pp.setTransitionDuration(2);
pp.setFlyTransitionEndScale(1);
pp.setTransitionDirection(90);
pp.setFlyTransitionAreaOpaque(true);
pp.setTransitionDimension(PdfPagePresentation.VERTICAL);
pp.setTransitionMotion(PdfPagePresentation.OUTWARD);
pp.setTransitionStyle(PdfPagePresentation.GLITTER);
// Apply transitiont to the page
page1.setPresentation(pp);
page1.drawCircle(new PdfPoint(300, 300), 100, false, true);
// Create another page
PdfPage page2 = (PdfPage) page1.clone();
page2.writeText("Page 2", 250, 250, 45.0);
// Modify the transition
pp.setTransitionStyle(PdfPagePresentation.DISSOLVE);
// Apply the modified transition to the second page
page2.setPresentation(pp);
| Modifier and Type | Field and Description |
|---|---|
static int |
BLINDS
Constant specifying a transition style where horizontal or
vertical blinds that sweep downward or to the right to display
the page.
|
static int |
BOTTOM_TO_TOP
Transition direction constant specifying transition effect that
moves at 90 degrees to the left-to-right direction (counting
counterclockwise).
|
static int |
BOX
Constant specifying a transition style where a box that either
moves from the edges to the center or otherwise to reveal the
page.
|
static int |
COVER
Constant specifying a transition style where the page slides in
from the direction specified by
setTransitionDirection(int). |
static int |
DISSOLVE
Constant specifying a transition style where the page is
revealed by gradually dissolves the previous page.
|
static int |
FADE
Constant specifying a transition style where the page is
gradually displayed, as the previous page fades away.
|
static int |
FLY
Constant specifying a transition style where page elements that
are different from the previous page float in or out as
specified by
setTransitionMotion(int) to a location
that is offscreen (except when
setTransitionDirection(int) has been called with
NONE. |
static int |
GLITTER
Constant specifying a transition style where the page is
displayed gradually, as wide band moves from one side of the
previous page to the other side in the direction specified by
setTransitionDirection(int). |
static int |
HORIZONTAL
Constant specifying that a transition effect occurs
horizontally.
|
static int |
INWARD
Constant specifying that a transition effect moves invward.
|
static int |
LEFT_TO_RIGHT
Transition direction constant specifying transition effect that
moves at 0 degrees to the left-to-right direction (counting
counterclockwise).
|
static String |
NONE
Transition direction constant specifying that page elements
different from the previous page do not float but simply scale
their size to or from the value specified by
setFlyTransitionEndScale(double). |
static int |
OUTWARD
Constant specifying that a transition effect moves outward.
|
static int |
PUSH
Constant specifying a transition style where the page pushes
out the previous page in the direction specified by
setTransitionDirection(int). |
static int |
REPLACE
Constant specifying a transition style with no effect.
|
static int |
RIGHT_TO_LEFT
Transition direction constant specifying transition effect that
moves at 180 degrees to the left-to-right direction (counting
counterclockwise).
|
static int |
SPLIT
Constant specifying a transition style where two lines sweep
across to display the page.
|
static int |
TOP_LEFT__TO__BOTTOM_RIGHT
Transition direction constant specifying transition effect that
moves at 315 degrees to the left-to-right direction (counting
counterclockwise).
|
static int |
TOP_TO_BOTTOM
Transition direction constant specifying transition effect that
moves at 270 degrees to the left-to-right direction (counting
counterclockwise).
|
static int |
UNCOVER
Constant specifying a transition style where the page is
revealed, as the previous page slides off the direction
specified by
setTransitionDirection(int). |
static int |
VERTICAL
Constant specifying that a transition effect occurs vertically.
|
static int |
WIPE
Constant specifying a transition style where a single line
sweeps across the screen in the direction specified by
setTransitionDirection(int) to revealing the new page. |
| Constructor and Description |
|---|
PdfPagePresentation() |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
double |
getFlyTransitionEndScale()
Returns starting or ending scale at which page elements that
are different from the previous page will be scaled during the
transition.
|
int |
getTransitionDimension()
Returns dimension in which a transition occurs.
|
int |
getTransitionDirection()
Returns angle of the direction in which transition effect
moves.
|
double |
getTransitionDuration()
Returns time (in seconds) taken to display the transition.
|
int |
getTransitionMotion()
Returns direction of the motion of a transition.
|
int |
getTransitionStyle()
Returns style of the transition
|
boolean |
isFlyTransitionAreaOpaque()
Returns whether the area that floats during the transition is
opaque.
|
void |
setFlyTransitionAreaOpaque(boolean flyTransitionAreaOpaque)
Specifies whether the area that floats during the transition
needs to be opaque.
|
void |
setFlyTransitionEndScale(double flyTransitionEndScale)
Specifies starting or ending scale at which page elements that
are different from the previous page need to be scaled during
the transition.
|
void |
setTransitionDimension(int transitionDimension)
Specifies dimension in which a transition needs to occur.
|
void |
setTransitionDirection(int transitionDirection)
Specifies angle of the direction in which transition effect
moves.
|
void |
setTransitionDuration(double transitionDuration)
Specifies time that needs to be taken to display the
transition.
|
void |
setTransitionMotion(int transitionMotion)
Specifies direction of the motion of the transition effect.
|
void |
setTransitionStyle(int transitionStyle)
Specifies style of the transition.
|
public static final int SPLIT
setTransitionDimension(int). Whether lines move
inward or outward can be specified by calling
setTransitionMotion(int).public static final int BLINDS
setTransitionDimension(int) to whether
the blinds have to be horizontal or vertical.public static final int BOX
setTransitionMotion(int) to specify how the
box moves.public static final int WIPE
setTransitionDirection(int) to revealing the new page.public static final int DISSOLVE
public static final int GLITTER
setTransitionDirection(int).public static final int REPLACE
setTransitionDuration(double).public static final int FLY
setTransitionMotion(int) to a location
that is offscreen (except when
setTransitionDirection(int) has been called with
NONE.public static final int PUSH
setTransitionDirection(int).public static final int COVER
setTransitionDirection(int).public static final int UNCOVER
setTransitionDirection(int).public static final int FADE
public static final int HORIZONTAL
public static final int VERTICAL
public static final int INWARD
public static final int OUTWARD
public static final int LEFT_TO_RIGHT
public static final int BOTTOM_TO_TOP
public static final int RIGHT_TO_LEFT
public static final int TOP_TO_BOTTOM
public static final int TOP_LEFT__TO__BOTTOM_RIGHT
public static final String NONE
setFlyTransitionEndScale(double).public int getTransitionStyle()
getTransitionStyle()public void setTransitionStyle(int transitionStyle)
transitionStyle - constant specifying style of the transitiongetTransitionStyle()public double getTransitionDuration()
setTransitionDuration(double)public void setTransitionDuration(double transitionDuration)
transitionDuration - time that needs to be taken to display the
transitiongetTransitionDuration()public int getTransitionDimension()
setTransitionDimension(int)public void setTransitionDimension(int transitionDimension)
BLINDS and
SPLIT transitions. Default dimension is
HORIZONTAL.transitionDimension - either HORIZONTAL or VERTICALgetTransitionDimension()public int getTransitionMotion()
getTransitionMotion()public void setTransitionMotion(int transitionMotion)
INWARD. This setting applies
only to BOX, FLY, and SPLIT.transitionMotion - either INWARD or OUTWARDgetTransitionMotion()public int getTransitionDirection()
setTransitionDirection(int)public void setTransitionDirection(int transitionDirection)
COVER,
FLY, GLITTER, PUSH,
UNCOVER, and WIPE transitions. Default angle
is LEFT_TO_RIGHT.transitionDirection - constant specifying angle of the direction in which
transition effect moves; any one of
NONE (only if
FLY andsetFlyTransitionEndScale(double) has
been used with a value less than 1.0)LEFT_TO_RIGHTBOTTOM_TO_TOP (only if transition is
WIPE)RIGHT_TO_LEFT (only if transition is
WIPE)TOP_TO_BOTTOMTOP_LEFT__TO__BOTTOM_RIGHT (only if
transition is GLITTER)getTransitionDirection()public boolean isFlyTransitionAreaOpaque()
setFlyTransitionAreaOpaque(boolean)public void setFlyTransitionAreaOpaque(boolean flyTransitionAreaOpaque)
flyTransitionAreaOpaque - whether the area that floats needs to be opaquepublic double getFlyTransitionEndScale()
setFlyTransitionEndScale(double)public void setFlyTransitionEndScale(double flyTransitionEndScale)
setTransitionMotion(int) has been
called with INWARD, then changes are scaled from
normal size times flyTransitionEndScale to 1. If
setTransitionMotion(int) has been called with
OUTWARD, then changes are scaled from normal size to
normal size times flyTransitionEndScale.flyTransitionEndScale - starting or ending scale at which page elements that
are different from the previous page are scaled
during the transition