|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.jpdf.PDFObject gnu.jpdf.PDFPage
public class PDFPage
This class defines a single page within a document. It is linked to a single PDFGraphics object
Nested Class Summary | |
---|---|
class |
PDFPage.procset
This defines a procset |
Field Summary | |
---|---|
protected java.util.Vector |
annotations
This holds any Annotations contained within this page. |
protected java.util.Vector |
contents
This holds the contents of the page. |
protected java.util.Vector |
fonts
The fonts associated with this page |
protected boolean |
hasImageB
These handle the procset for this page. |
protected boolean |
hasImageC
These handle the procset for this page. |
protected boolean |
hasImageI
These handle the procset for this page. |
protected java.util.Vector |
imageResources
|
static int |
INVERTEDPORTRAIT
Specifies that the page is in INVERTEDPORTRAIT orientation. |
static int |
LANDSCAPE
Specifies that the page is in LANDSCAPE orientation. |
static java.awt.Rectangle |
MEDIA_11x17
Rectangle defining a page in 11x17 format. |
static java.awt.Rectangle |
MEDIA_a0
Rectangle defining a page in a0 format. |
static java.awt.Rectangle |
MEDIA_a1
Rectangle defining a page in a1 format. |
static java.awt.Rectangle |
MEDIA_a10
Rectangle defining a page in a10 format. |
static java.awt.Rectangle |
MEDIA_a2
Rectangle defining a page in a2 format. |
static java.awt.Rectangle |
MEDIA_a3
Rectangle defining a page in a3 format. |
static java.awt.Rectangle |
MEDIA_a4
Rectangle defining a page in a4 format. |
static java.awt.Rectangle |
MEDIA_a5
Rectangle defining a page in a5 format. |
static java.awt.Rectangle |
MEDIA_a6
Rectangle defining a page in a6 format. |
static java.awt.Rectangle |
MEDIA_a7
Rectangle defining a page in a7 format. |
static java.awt.Rectangle |
MEDIA_a8
Rectangle defining a page in a8 format. |
static java.awt.Rectangle |
MEDIA_a9
Rectangle defining a page in a9 format. |
static java.awt.Rectangle |
MEDIA_archA
Rectangle defining a page in archA format. |
static java.awt.Rectangle |
MEDIA_archB
Rectangle defining a page in archB format. |
static java.awt.Rectangle |
MEDIA_archC
Rectangle defining a page in archC format. |
static java.awt.Rectangle |
MEDIA_archD
Rectangle defining a page in archD format. |
static java.awt.Rectangle |
MEDIA_archE
Rectangle defining a page in archE format. |
static java.awt.Rectangle |
MEDIA_b0
Rectangle defining a page in b0 format. |
static java.awt.Rectangle |
MEDIA_b1
Rectangle defining a page in b1 format. |
static java.awt.Rectangle |
MEDIA_b2
Rectangle defining a page in b2 format. |
static java.awt.Rectangle |
MEDIA_b3
Rectangle defining a page in b3 format. |
static java.awt.Rectangle |
MEDIA_b4
Rectangle defining a page in b4 format. |
static java.awt.Rectangle |
MEDIA_b5
Rectangle defining a page in b5 format. |
static java.awt.Rectangle |
MEDIA_flsa
Rectangle defining a page in flsa format. |
static java.awt.Rectangle |
MEDIA_flse
Rectangle defining a page in flse format. |
static java.awt.Rectangle |
MEDIA_halfletter
Rectangle defining a page in halfletter format. |
static java.awt.Rectangle |
MEDIA_ledger
Rectangle defining a page in ledger format. |
static java.awt.Rectangle |
MEDIA_legal
Rectangle defining a page in legal format. |
static java.awt.Rectangle |
MEDIA_letter
Rectangle defining a page in letter format. |
static java.awt.Rectangle |
MEDIA_note
Rectangle defining a page in note format. |
protected java.awt.Rectangle |
mediabox
This is this pages media box, ie the size of the page |
protected PDFObject |
pdfPageList
This is the pages object id that this page belongs to. |
static int |
PORTRAIT
Specifies that the page is in PORTRAIT orientation. |
protected PDFPage.procset |
procset
|
protected java.util.Vector |
resources
This holds any resources for this page |
protected int |
rotate
Specifies the number of degrees the page should be rotated clockwise when it is displayed. |
static int |
SEASCAPE
Specifies that the page is in SEASCAPE orientation. |
protected PDFObject |
thumbnail
Object ID that contains a thumbnail sketch of the page. |
Fields inherited from class gnu.jpdf.PDFObject |
---|
objser, pdfDocument |
Constructor Summary | |
---|---|
PDFPage()
This constructs a Page object, which will hold any contents for this page. |
|
PDFPage(int rotate)
Constructs a page using A4 media, but using the supplied orientation. |
|
PDFPage(java.awt.Rectangle mediabox)
Constructs a page, using the supplied media size. |
|
PDFPage(java.awt.Rectangle mediabox,
int rotate)
Constructs a page using the supplied media size and orientation. |
Method Summary | |
---|---|
void |
add(PDFObject ob)
This adds an object that describes some content to this page. |
void |
addAnnotation(PDFObject ob)
This adds an Annotation to the page. |
void |
addImageResource(java.lang.String resource)
|
PDFAnnot |
addLink(int x,
int y,
int w,
int h,
PDFObject dest)
Adds a hyperlink to the document. |
PDFAnnot |
addLink(int x,
int y,
int w,
int h,
PDFObject dest,
int vx,
int vy,
int vw,
int vh)
Adds a hyperlink to the document. |
PDFAnnot |
addNote(java.lang.String note,
int x,
int y,
int w,
int h)
This method adds a text note to the document. |
PDFOutline |
addOutline(java.lang.String title)
This method attaches an outline to the current page being generated. |
PDFOutline |
addOutline(java.lang.String title,
int x,
int y,
int w,
int h)
This method attaches an outline to the current page being generated. |
void |
addResource(java.lang.String resource)
This adds a resource to the page. |
void |
addToProcset(java.lang.String proc)
|
void |
addXObject(java.lang.String inxobject)
This adds an XObject resource to the page. |
int |
cx(int x,
int y)
This utility method converts the y coordinate from Java to User space within the page. |
int[] |
cxy(int x,
int y)
This utility method converts the Java coordinates to User space within the page. |
int |
cy(int x,
int y)
This utility method converts the y coordinate from Java to User space within the page. |
java.awt.Dimension |
getDimension()
|
PDFFont |
getFont(java.lang.String type,
java.lang.String font,
int style)
Returns a PDFFont, creating it if not yet used. |
PDFGraphics |
getGraphics()
This returns a PDFGraphics object, which can then be used to render on to this page. |
java.awt.Rectangle |
getMedia()
Returns the page's media. |
int |
getOrientation()
Returns the pages orientation |
void |
setMedia(java.awt.Rectangle mediabox)
Sets the media size for this page. |
void |
setOrientation(int rotate)
Sets the page's orientation. |
void |
setThumbnail(PDFObject thumbnail)
This adds an object that describes a thumbnail for this page. |
void |
write(java.io.OutputStream os)
Writes the object to the output stream. |
Methods inherited from class gnu.jpdf.PDFObject |
---|
getPDFDocument, getSerialID, getType, toArray, toString, writeEnd, writeStart |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int PORTRAIT
public static final int LANDSCAPE
public static final int INVERTEDPORTRAIT
public static final int SEASCAPE
public static final java.awt.Rectangle MEDIA_letter
public static final java.awt.Rectangle MEDIA_note
public static final java.awt.Rectangle MEDIA_legal
public static final java.awt.Rectangle MEDIA_a0
public static final java.awt.Rectangle MEDIA_a1
public static final java.awt.Rectangle MEDIA_a2
public static final java.awt.Rectangle MEDIA_a3
public static final java.awt.Rectangle MEDIA_a4
public static final java.awt.Rectangle MEDIA_a5
public static final java.awt.Rectangle MEDIA_a6
public static final java.awt.Rectangle MEDIA_a7
public static final java.awt.Rectangle MEDIA_a8
public static final java.awt.Rectangle MEDIA_a9
public static final java.awt.Rectangle MEDIA_a10
public static final java.awt.Rectangle MEDIA_b0
public static final java.awt.Rectangle MEDIA_b1
public static final java.awt.Rectangle MEDIA_b2
public static final java.awt.Rectangle MEDIA_b3
public static final java.awt.Rectangle MEDIA_b4
public static final java.awt.Rectangle MEDIA_b5
public static final java.awt.Rectangle MEDIA_archE
public static final java.awt.Rectangle MEDIA_archD
public static final java.awt.Rectangle MEDIA_archC
public static final java.awt.Rectangle MEDIA_archB
public static final java.awt.Rectangle MEDIA_archA
public static final java.awt.Rectangle MEDIA_flsa
public static final java.awt.Rectangle MEDIA_flse
public static final java.awt.Rectangle MEDIA_halfletter
public static final java.awt.Rectangle MEDIA_11x17
public static final java.awt.Rectangle MEDIA_ledger
protected java.awt.Rectangle mediabox
protected PDFObject pdfPageList
protected java.util.Vector contents
protected int rotate
PORTRAIT
,
LANDSCAPE
,
INVERTEDPORTRAIT
,
SEASCAPE
protected PDFObject thumbnail
protected java.util.Vector annotations
protected java.util.Vector resources
protected java.util.Vector imageResources
protected java.util.Vector fonts
protected boolean hasImageB
protected boolean hasImageC
protected boolean hasImageI
protected PDFPage.procset procset
Constructor Detail |
---|
public PDFPage()
Once created, it is added to the document via the PDF.add() method. (For Advanced use, via the PDFPages.add() method).
This defaults to a4 media.
public PDFPage(java.awt.Rectangle mediabox)
mediabox
- Rectangle describing the page sizepublic PDFPage(int rotate)
rotate
- Rotation: 0, 90, 180 or 270PORTRAIT
,
LANDSCAPE
,
INVERTEDPORTRAIT
,
SEASCAPE
public PDFPage(java.awt.Rectangle mediabox, int rotate)
mediabox
- Rectangle describing the page sizerotate
- Rotation: 0, 90, 180 or 270PORTRAIT
,
LANDSCAPE
,
INVERTEDPORTRAIT
,
SEASCAPE
Method Detail |
---|
public void addToProcset(java.lang.String proc)
public PDFGraphics getGraphics()
public PDFFont getFont(java.lang.String type, java.lang.String font, int style)
type
- Font type, usually /Type1font
- Font namestyle
- java.awt.Font style, ie Font.NORMALpublic void setMedia(java.awt.Rectangle mediabox)
Normally, this should be done when the page is created, to avoid problems.
mediabox
- Rectangle describing the page sizepublic java.awt.Rectangle getMedia()
public java.awt.Dimension getDimension()
public void setOrientation(int rotate)
Normally, this should be done when the page is created, to avoid problems.
rotate
- Rotation: 0, 90, 180 or 270public int getOrientation()
PORTRAIT
,
LANDSCAPE
,
INVERTEDPORTRAIT
,
SEASCAPE
public void add(PDFObject ob)
Note: Objects that describe contents must be added using this method _AFTER_ the PDF.add() method has been called.
ob
- PDFObject describing some contentspublic void addAnnotation(PDFObject ob)
As with other objects, the annotation must be added to the pdf document using PDF.add() before adding to the page.
ob
- Annotation to add.public PDFAnnot addNote(java.lang.String note, int x, int y, int w, int h)
note
- Text of the notex
- Coordinate of notey
- Coordinate of notew
- Width of the noteh
- Height of the note
public PDFAnnot addLink(int x, int y, int w, int h, PDFObject dest)
x
- Coordinate of active areay
- Coordinate of active areaw
- Width of the active areah
- Height of the active areadest
- Page that will be displayed when the link is activated. When
displayed, the zoom factor will be changed to fit the display.
public PDFAnnot addLink(int x, int y, int w, int h, PDFObject dest, int vx, int vy, int vw, int vh)
x
- Coordinate of active areay
- Coordinate of active areaw
- Width of the active areah
- Height of the active areadest
- Page that will be displayed when the link is activatedvx
- Coordinate of what part of the page should be displayedvy
- Coordinate of what part of the page should be displayedvw
- Width of the what part of the page should be displayedvh
- Height of the what part of the page should be displayed
(defined in Java coordinates). If this is null, then the page is fitted to
the display.
public void addXObject(java.lang.String inxobject)
public void addResource(java.lang.String resource)
resource
- String defining the resourcepublic void addImageResource(java.lang.String resource)
public void setThumbnail(PDFObject thumbnail)
Note: The object must already exist in the PDF, as only the object ID is stored.
thumbnail
- PDFObject containing the thumbnailpublic PDFOutline addOutline(java.lang.String title)
title
- Outline title to attach
public PDFOutline addOutline(java.lang.String title, int x, int y, int w, int h)
Note: If the outline is not in the top level (ie below another outline) then it must not be passed to this method.
title
- Outline title to attachx
- int coordinate of regiony
- int coordinate of regionw
- int coordinate of regionh
- int coordinate of region
public void write(java.io.OutputStream os) throws java.io.IOException
PDFObject
Writes the object to the output stream. This method must be overidden.
Note: It should not write any other objects, even if they are it's Kids, as they will be written by the calling routine.
write
in class PDFObject
os
- OutputStream to send the object to
java.io.IOException
- on errorpublic int cy(int x, int y)
y
- Coordinate in Java space
public int cx(int x, int y)
y
- Coordinate in Java space
public int[] cxy(int x, int y)
x
- Coordinate in Java spacey
- Coordinate in Java space
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |