|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.qoppa.pdfViewer.hiObjects.AbstractPDFPage
com.qoppa.pdfProcess.PDFPage
This class holds a page in a PDF document.
| Field Summary | |
static int |
COMPRESSION_DEFLATE
|
static int |
COMPRESSION_JBIG2
|
static int |
COMPRESSION_JPEG
|
| Method Summary | |
void |
addAnnotation(Annotation annot)
Adds an annotation to this page. |
void |
addJPEGImage(File jpegFile,
int x,
int y,
AffineTransform xform)
Adds a JPEG image onto this page. |
SignatureField |
addSignatureField(String fieldName,
Rectangle2D bounds)
Adds a signature field to this page. |
Graphics2D |
createGraphics()
Creates a Graphics2D object to draw into this page. |
Graphics2D |
createGraphics(Layer layer)
Creates a graphics object that encapsulates a layer in a PDF document. |
void |
deleteAnnotations()
Delete all annotations from the page. |
void |
drawImage(Image image,
int dstX,
int dstY,
Color bgndColor,
AffineTransform xform,
ImageParam params)
Draws an image onto this page. |
void |
drawImage(Image image,
int dstX,
int dstY,
int dstWidth,
int dstHeight,
Color bgndColor,
AffineTransform xform,
ImageParam params)
Draws an image onto this page. |
void |
drawText(String str,
Font font,
Paint textPaint,
double x,
double y,
AffineTransform xform)
Draws text onto this page. |
void |
fillShape(Shape shape,
Paint shapePaint,
double offsetX,
double offsetY,
AffineTransform xform)
Fills a shape on this page. |
Vector |
findText(String searchText,
boolean caseSensitive,
boolean wholeWords)
Searches the page for text and returns a list of TextPosition objects for each of the occurrences of the string in the page. |
void |
flattenAnnotation(Annotation annot)
Flatten the given annotation. |
void |
flattenAnnotations(boolean paintNonPrintableAnnots)
Flattens the annotations. |
void |
flattenWidget(Widget widget)
Flatten a widget into the content layer of the page. |
Vector |
getAnnotations()
Returns a list of PDF annotations in this page. |
Rectangle2D |
getArtBox()
Return this page's Art Box. |
Rectangle2D |
getBleedBox()
Return this page's Bleed Box. |
Rectangle2D |
getCropBox()
Returns the PDF page's 'CropBox'. |
double |
getDisplayHeight()
Returns the display height of this page in 72 DPI. |
double |
getDisplayWidth()
Returns the display width of this page in 72 DPI. |
double |
getDisplayX()
Returns the page's left margin. |
double |
getDisplayY()
Returns the page's top margin. |
PDFDocument |
getDocument()
Returns the document that this page belongs to. |
BufferedImage |
getImage()
Returns a BufferedImage containing a rendering of the page at the default PDF resolution: 72 DPI. |
BufferedImage |
getImage(int dpi)
Returns a BufferedImage containing a rendering of the page at the given resolution in DPI. |
Rectangle2D |
getMediaBox()
Returns the PDF page's 'MediaBox'. |
int |
getPageIndex()
Gets the page index of this page within the document. |
int |
getPageRotation()
Returns the rotation of this page in degrees. |
double |
getPaperHeight()
Returns the paper's height of this page in 72 DPI. |
double |
getPaperWidth()
Returns the paper's width of this page in 72 DPI. |
BufferedImage |
getSubImage(Rectangle2D pageArea,
int dpi)
|
Rectangle2D |
getTrimBox()
Return this page's Trim Box. |
void |
invalidate()
Invalidate paint cache. |
void |
removeAnnotation(Annotation annot)
Removes an annotation from this page. |
void |
savePageAsJPEG(OutputStream outStream,
int dpi,
float quality)
Render the page as an image and save it to the output stream in JPEG format. |
void |
savePageAsPNG(OutputStream outStream,
int dpi)
Render the page as an image and save it to the output stream in PNG format. |
void |
savePageAsTIFF(OutputStream outStream,
double resDPI,
String tiffCompression)
Save the rendering image of the page to the given OutputStream in TIFF format. |
void |
savePageAsTIFF(OutputStream outStream,
TIFFOptions options)
Render the page to an image and save it in TIFF format to the given OutputStream. |
void |
setArtBox(Rectangle2D rect)
Sets this page's Art Box. |
void |
setBleedBox(Rectangle2D rect)
Sets this page's Bleed Box. |
void |
setClip(Area newClip)
|
void |
setCropBox(Rectangle2D rect)
Sets the PDF page's 'CropBox'. |
void |
setDocument(PDFDocument parentDoc)
|
void |
setPageRotation(int degrees)
Changes this page's rotation. |
void |
setTrimBox(Rectangle2D rect)
Sets this page's Trim Box. |
void |
strokeShape(Shape shape,
Paint shapePaint,
double offsetX,
double offsetY,
AffineTransform xform)
Draws the outline of a shape on this page. |
String |
useGradientPaint(GradientPaint paint)
|
String |
useGState(double strokeAlpha,
double fillAlpha)
|
void |
writeAnnotsAsFDF(PDFArray annotsArray,
int pageIndex)
Internal do not use. |
void |
writeAnnotsAsXFDF(nanoxml.XMLElement topElement,
Integer pageIndex)
Internal do not use |
| Methods inherited from class com.qoppa.pdfViewer.hiObjects.AbstractPDFPage |
clearTextSelection, getImage, getSelectedText, getStringPositionInfo, paintPage, printPage, selectText, setInvertMode, setSelectedText |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.qoppa.pdf.dom.IPDFPage |
clearTextSelection, getImage, getSelectedText, paintPage, printPage, selectText, setInvertMode |
| Field Detail |
public static final int COMPRESSION_JPEG
public static final int COMPRESSION_DEFLATE
public static final int COMPRESSION_JBIG2
| Method Detail |
public Vector getAnnotations()
throws PDFException
getAnnotations in interface IPDFPagePDFException
public Graphics2D createGraphics()
throws PDFException
PDFException
public Graphics2D createGraphics(Layer layer)
throws PDFException
layer - The layer to draw into. This object must be created through PDFDocument.addLayer()
PDFExceptionpublic Rectangle2D getCropBox()
getCropBox in interface IPDFPage
public BufferedImage getImage()
throws PDFException
PDFException
public BufferedImage getImage(int dpi)
throws PDFException
dpi - Dots per inch at which to render the image.
PDFException
public BufferedImage getSubImage(Rectangle2D pageArea,
int dpi)
throws PDFException
PDFException
public void savePageAsJPEG(OutputStream outStream,
int dpi,
float quality)
throws IOException,
PDFException
outStream - The stream to save the image to.dpi - Dots per inch at which to render the image. 72 is the native PDF resolution.quality - The quality setting to use for JPEG compression. The range for this value is 0.0 to 1.0.
Lower values mean higher compression and lower quality. As a guideline, 0.25 is low quality, 0.5 is medium
quality and 0.75 is high quality.
IOException
PDFException
public void savePageAsPNG(OutputStream outStream,
int dpi)
throws PDFException,
IOException
outStream - The stream to save the image to.dpi - Dots per inch at which to render the image. 72 is the native PDF resolution.
PDFException
IOException
public void savePageAsTIFF(OutputStream outStream,
double resDPI,
String tiffCompression)
throws IOException,
PDFException
outStream - The stream to save the image to.resDPI - Dots per inch at which to render the image.tiffCompression - The type of TIFF compression to use. This value needs to be one of
these predefined values:IOException
PDFException
public void savePageAsTIFF(OutputStream outStream,
TIFFOptions options)
throws IOException,
PDFException
outStream - The stream to save the image to.options - Options when saving the image, such as the output DPI, the TIFF compression method and more.
IOException
PDFExceptionpublic Rectangle2D getMediaBox()
getMediaBox in interface IPDFPagepublic double getPaperHeight()
public double getPaperWidth()
public double getDisplayWidth()
getDisplayWidth in interface IPDFPagepublic double getDisplayHeight()
getDisplayHeight in interface IPDFPagepublic double getDisplayX()
IPDFPage
getDisplayX in interface IPDFPagepublic double getDisplayY()
IPDFPage
getDisplayY in interface IPDFPagepublic int getPageRotation()
getPageRotation in interface IPDFPagepublic void setPageRotation(int degrees)
degrees - The new page rotation, in degreespublic PDFDocument getDocument()
public void invalidate()
public void addAnnotation(Annotation annot)
throws PDFException
annot - The annotation to add.
PDFException
public SignatureField addSignatureField(String fieldName,
Rectangle2D bounds)
throws PDFException
PDFDocument.signDocument.
To create an invisible signature field, the bound rectangle should be set to (0,0,0,0) for the bounds.
fieldName - The name of the new field.bounds - The bounds of the field on the page. (0,0,0,0) indicates that the signature field will be invisible.
PDFExceptionpublic int getPageIndex()
public void removeAnnotation(Annotation annot)
throws PDFException
annot - A reference to the annotation that needs to be removed.
PDFException
public void drawImage(Image image,
int dstX,
int dstY,
Color bgndColor,
AffineTransform xform,
ImageParam params)
throws PDFException
image - The image to draw.dstX - The horizontal position of the image in 72 DPI.dstY - The vertical position of the image in 72 DPI.bgndColor - The background color if any. If this parameter is not null, the method will first
fill a rectangle with this color where the image will be drawn, then draw the image on top.xform - A transform to apply to the image before drawing it to the page. This parameter can be left null for no transform.params - An ImageParam object describing what compression to use when writing images to the PDF document. If null, the
library will use default settings.
PDFException
public void drawImage(Image image,
int dstX,
int dstY,
int dstWidth,
int dstHeight,
Color bgndColor,
AffineTransform xform,
ImageParam params)
throws PDFException
image - The image to draw.dstX - The horizontal position of the image in 72 DPI.dstY - The vertical position of the image in 72 DPI.dstWidth - The width on the page that the image will occupy. If this is <= 0, the method will use the image's width.dstHeight - The height on the page that the image will occupy. If this is <= 0, the method will use the image's height.bgndColor - The background color if any. If this parameter is not null, the method will first
fill a rectangle with this color where the image will be drawn, then draw the image on top.xform - A transform to apply to the image before drawing it to the page. This parameter can be left null for no transform.params - An ImageParam object describing what compression to use when writing images to the PDF document. If null, the
library will use default settings.
PDFException
public void addJPEGImage(File jpegFile,
int x,
int y,
AffineTransform xform)
throws PDFException,
IOException
jpegFile - The JPEG file.x - The horizontal position of the image in 72 DPI.y - The vertical position of the image in 72 DPI.xform - A transform to apply to the image before drawing it to the page. This parameter can be left null for no transform.
PDFException
IOException
public void fillShape(Shape shape,
Paint shapePaint,
double offsetX,
double offsetY,
AffineTransform xform)
shape - The shape to fill.shapePaint - The color to use when filling the shape.offsetX - A horizontal offset to apply before drawing the shape, in 72 DPI.offsetY - A vertical offset to apply before drawing teh shape, in 72 DPI.xform - A transform to apply to the shape before drawing it to the page.
public void flattenAnnotation(Annotation annot)
throws PDFException
annot - The annotation to flatten into the content layer.
PDFException
public void flattenAnnotations(boolean paintNonPrintableAnnots)
throws PDFException
paintNonPrintableAnnots - Flag to indicate whether non-printable annotations should be painted or not.
PDFException
public void deleteAnnotations()
throws PDFException
PDFException
public void flattenWidget(Widget widget)
throws PDFException
widget - The widget to flatten
PDFException
public void strokeShape(Shape shape,
Paint shapePaint,
double offsetX,
double offsetY,
AffineTransform xform)
shape - The shape whose outline will be drawn.shapePaint - The color to use when drawing the outline of the shape.offsetX - A horizontal offset to apply before drawing the shape, in 72 DPI.offsetY - A vertical offset to apply before drawing teh shape, in 72 DPI.xform - A transform to apply to the shape before drawing it to the page.
public void drawText(String str,
Font font,
Paint textPaint,
double x,
double y,
AffineTransform xform)
throws PDFException
str - The string to draw on the page.font - The font to use when drawing the text.textPaint - The color to use when drawing the text.x - The horizontal position of the text on the page, in 72 DPI.y - The vertical position of the text on the page, in 72 DPI.xform - A transform to apply to the text before drawing it to the page.
PDFExceptionpublic Rectangle2D getBleedBox()
getBleedBox in interface IPDFPagepublic Rectangle2D getTrimBox()
getTrimBox in interface IPDFPagepublic Rectangle2D getArtBox()
getArtBox in interface IPDFPagepublic void setCropBox(Rectangle2D rect)
public void setBleedBox(Rectangle2D rect)
public void setTrimBox(Rectangle2D rect)
public void setArtBox(Rectangle2D rect)
public void writeAnnotsAsFDF(PDFArray annotsArray,
int pageIndex)
public void writeAnnotsAsXFDF(nanoxml.XMLElement topElement,
Integer pageIndex)
throws PDFException
PDFException
public String useGradientPaint(GradientPaint paint)
throws PDFException
PDFException
public String useGState(double strokeAlpha,
double fillAlpha)
throws PDFException
PDFExceptionpublic void setDocument(PDFDocument parentDoc)
public void setClip(Area newClip)
throws PDFException
PDFException
public Vector findText(String searchText,
boolean caseSensitive,
boolean wholeWords)
throws PDFException
searchText - The text to search for.caseSensitive - Flag indicating whether the search should be case sensitive.wholeWords - Flag indicating whether the search should only look at whole words.
PDFException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||