public class PDPage extends Object implements COSObjectable, Printable
This class implements the Printable
interface, but since PDFBox
version 1.3.0 you should be using the PDPageable
adapter instead
(see PDFBOX-788).
Modifier and Type | Field and Description |
---|---|
static PDRectangle |
PAGE_SIZE_A0
A page size of A0 Paper.
|
static PDRectangle |
PAGE_SIZE_A1
A page size of A1 Paper.
|
static PDRectangle |
PAGE_SIZE_A2
A page size of A2 Paper.
|
static PDRectangle |
PAGE_SIZE_A3
A page size of A3 Paper.
|
static PDRectangle |
PAGE_SIZE_A4
A page size of A4 Paper.
|
static PDRectangle |
PAGE_SIZE_A5
A page size of A5 Paper.
|
static PDRectangle |
PAGE_SIZE_A6
A page size of A6 Paper.
|
static PDRectangle |
PAGE_SIZE_LETTER
A page size of LETTER or 8.5x11.
|
NO_SUCH_PAGE, PAGE_EXISTS
Constructor and Description |
---|
PDPage()
Creates a new instance of PDPage with a size of 8.5x11.
|
PDPage(COSDictionary pageDic)
Creates a new instance of PDPage.
|
PDPage(PDRectangle size)
Creates a new instance of PDPage.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Calling this will release all cached information.
|
BufferedImage |
convertToImage()
Convert this page to an output image with 8 bits per pixel and the double
default screen resolution.
|
BufferedImage |
convertToImage(int imageType,
int resolution)
Convert this page to an output image.
|
boolean |
equals(Object other) |
PDRectangle |
findCropBox()
This will find the CropBox for this page by looking up the hierarchy until
it finds them.
|
PDRectangle |
findMediaBox()
This will find the MediaBox for this page by looking up the hierarchy until
it finds them.
|
PDResources |
findResources()
This will find the resources for this page by looking up the hierarchy until
it finds them.
|
int |
findRotation()
This will find the rotation for this page by looking up the hierarchy until
it finds them.
|
PDPageAdditionalActions |
getActions()
Get the page actions.
|
List<PDAnnotation> |
getAnnotations()
This will return a list of the annotations for this page.
|
PDRectangle |
getArtBox()
A rectangle, expressed in default user space units, defining
the extent of the page's meaningful content (including potential
white space) as intended by the page's creator The default isthe CropBox.
|
PDRectangle |
getBleedBox()
A rectangle, expressed in default user space units, defining
the region to which the contents of the page should be clipped
when output in a production environment.
|
PDStream |
getContents()
This will get the contents of the PDF Page, in the case that the contents
of the page is an array then then the entire array of streams will be
be wrapped and appear as a single stream.
|
COSDictionary |
getCOSDictionary()
This will get the underlying dictionary that this class acts on.
|
COSBase |
getCOSObject()
Convert this standard java object to a COS object.
|
PDRectangle |
getCropBox()
A rectangle, expressed in default user space units,
defining the visible region of default user space.
|
Calendar |
getLastModified()
This will get the date that the content stream was last modified.
|
PDRectangle |
getMediaBox()
A rectangle, expressed
in default user space units, defining the boundaries of the physical
medium on which the page is intended to be displayed or printed
This will get the MediaBox at this page and not look up the hierarchy.
|
PDMetadata |
getMetadata()
Get the metadata that is part of the document catalog.
|
PDPageNode |
getParent()
This is the parent page node.
|
PDResources |
getResources()
This will get the resources at this page and not look up the hierarchy.
|
Integer |
getRotation()
A value representing the rotation.
|
int |
getStructParents()
This will get the key of this Page in the structural parent tree.
|
List<PDThreadBead> |
getThreadBeads()
This will get a list of PDThreadBead objects, which are article threads in the document.
|
PDRectangle |
getTrimBox()
A rectangle, expressed in default user space units, defining
the intended dimensions of the finished page after trimming.
|
int |
hashCode() |
int |
print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
Deprecated.
Use the
PDPageable adapter class
|
void |
setActions(PDPageAdditionalActions actions)
Set the page actions.
|
void |
setAnnotations(List<PDAnnotation> annots)
This will set the list of annotations.
|
void |
setArtBox(PDRectangle artBox)
This will set the ArtBox for this page.
|
void |
setBleedBox(PDRectangle bleedBox)
This will set the BleedBox for this page.
|
void |
setContents(PDStream contents)
This will set the contents of this page.
|
void |
setCropBox(PDRectangle cropBox)
This will set the CropBox for this page.
|
void |
setMediaBox(PDRectangle mediaBoxValue)
This will set the mediaBox for this page.
|
void |
setMetadata(PDMetadata meta)
Set the metadata for this object.
|
void |
setParent(PDPageNode parentNode)
This will set the parent of this page.
|
void |
setResources(PDResources resources)
This will set the resources for this page.
|
void |
setRotation(int rotation)
This will set the rotation for this page.
|
void |
setStructParents(int structParents)
This will set the key for this page in the structural parent tree.
|
void |
setThreadBeads(List<PDThreadBead> beads)
This will set the list of thread beads.
|
void |
setTrimBox(PDRectangle trimBox)
This will set the TrimBox for this page.
|
void |
updateLastModified()
This will update the last modified time for the page object.
|
public static final PDRectangle PAGE_SIZE_LETTER
public static final PDRectangle PAGE_SIZE_A0
public static final PDRectangle PAGE_SIZE_A1
public static final PDRectangle PAGE_SIZE_A2
public static final PDRectangle PAGE_SIZE_A3
public static final PDRectangle PAGE_SIZE_A4
public static final PDRectangle PAGE_SIZE_A5
public static final PDRectangle PAGE_SIZE_A6
public PDPage()
public PDPage(PDRectangle size)
size
- The MediaBox or the page.public PDPage(COSDictionary pageDic)
pageDic
- The existing page dictionary.public COSBase getCOSObject()
getCOSObject
in interface COSObjectable
public COSDictionary getCOSDictionary()
public PDPageNode getParent()
public void setParent(PDPageNode parentNode)
parentNode
- The parent to this page node.public void updateLastModified()
public Calendar getLastModified() throws IOException
IOException
- If there is an error accessing the date information.public PDResources getResources()
public PDResources findResources()
public void setResources(PDResources resources)
resources
- The new resources for this page.public int getStructParents()
public void setStructParents(int structParents)
structParents
- The new key for this page.public PDRectangle getMediaBox()
public PDRectangle findMediaBox()
public void setMediaBox(PDRectangle mediaBoxValue)
mediaBoxValue
- The new mediaBox for this page.public PDRectangle getCropBox()
public PDRectangle findCropBox()
public void setCropBox(PDRectangle cropBox)
cropBox
- The new CropBox for this page.public PDRectangle getBleedBox()
public void setBleedBox(PDRectangle bleedBox)
bleedBox
- The new BleedBox for this page.public PDRectangle getTrimBox()
public void setTrimBox(PDRectangle trimBox)
trimBox
- The new TrimBox for this page.public PDRectangle getArtBox()
public void setArtBox(PDRectangle artBox)
artBox
- The new ArtBox for this page.public Integer getRotation()
public int findRotation()
public void setRotation(int rotation)
rotation
- The new rotation for this page in degrees.public PDStream getContents() throws IOException
IOException
- If there is an error obtaining the stream.public void setContents(PDStream contents)
contents
- The new contents of the page.public List<PDThreadBead> getThreadBeads()
public void setThreadBeads(List<PDThreadBead> beads)
beads
- A list of PDThreadBead objects or null.public PDMetadata getMetadata()
public void setMetadata(PDMetadata meta)
meta
- The meta data for this object.public BufferedImage convertToImage() throws IOException
IOException
- If there is an error drawing to the image.public BufferedImage convertToImage(int imageType, int resolution) throws IOException
imageType
- the image type (see BufferedImage
.TYPE_*)resolution
- the resolution in dpi (dots per inch)IOException
- If there is an error drawing to the image.public PDPageAdditionalActions getActions()
public void setActions(PDPageAdditionalActions actions)
actions
- The actions for the page.public List<PDAnnotation> getAnnotations() throws IOException
IOException
- If there is an error while creating the annotation list.public void setAnnotations(List<PDAnnotation> annots)
annots
- The new list of annotations.public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
PDPageable
adapter class
print
in interface Printable
PrinterException
public void clear()
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.