public class PDFPage
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
COMPRESSION_DEFLATE |
static int |
COMPRESSION_JBIG2 |
static int |
COMPRESSION_JPEG |
static int |
DEFAULT_BACKGROUND_COLOR
The background color that will be used when rendering a page, if no specific color has been set.
|
com.qoppa.android.pdf.loObjects.PDFDictionary |
m_PageDict |
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(Annotation annot)
Adds an annotation to this page.
|
SignatureField |
addSignatureField(java.lang.String fieldName,
RectF bounds)
Adds a signature field to this page.
|
PointF |
convPoint(float x,
float y)
Converts a point from visual coordinates to PDF coordinate.
|
RectF |
convRect(RectF toConv)
Converts a rectangle from visual coordinates to PDF coordinate.
|
PDFCanvas |
createCanvas()
Creates a canvas object to draw into this page.
|
void |
deleteAnnotations()
Delete all annotations from the page.
|
java.util.List<TextPosition> |
findTextOccurrences(java.lang.String searchString)
Searches for a string in this page.
|
java.util.List<TextPositionWithContext> |
findTextOccurrencesWithContext(java.lang.String searchString) |
void |
flattenAnnotations(boolean paintNonPrintableAnnots)
Flattens the annotations.
|
java.lang.String |
getAllText()
Returns all text for this page.
|
java.util.Vector<Annotation> |
getAnnotations()
Returns a list of PDF annotations in this page.
|
com.qoppa.android.pdf.text.AsyncTextModel |
getAsyncTextModel() |
int |
getBackgroundColor()
Returns the background color to use when rendering this page.
|
Bitmap |
getBitmap()
Returns a Bitmap object containing a rendering
of the page at the default PDF resolution: 72 DPI.
|
Bitmap |
getBitmap(int width,
int height,
boolean paintAnnotations)
Returns a Bitmap containing a rendering of the page at a specific width and height.
|
Bitmap |
getBitmap(Rect rect,
boolean paintAnnotations)
Returns a Bitmap containing a rendering of the page for the specified rectangle
|
com.qoppa.android.pdf.util.PeekInputStream |
getContentStream() |
RectF |
getCropBox()
Returns the PDF page's 'CropBox'.
|
float |
getDisplayBottom()
Returns the cropbox's bottom most y
|
float |
getDisplayHeight()
Returns the display height of this page in 72 DPI.
|
float |
getDisplayRight()
Returns the cropbox's right most x
|
float |
getDisplayWidth()
Returns the display width of this page in 72 DPI.
|
float |
getDisplayX()
Returns the crop box's X origin.
|
float |
getDisplayY()
Returns the crop box's Y origin.
|
PDFDocument |
getDocument()
Returns the document that this page belongs to.
|
IPicture |
getIPicture()
This picture caches the drawing commands for the page.
|
RectF |
getMediaBox()
Returns the PDF page's 'MediaBox'.
|
Matrix |
getMirror() |
com.qoppa.android.pdf.loObjects.PDFDictionary |
getPageDict() |
int |
getPageIndex()
Gets the page index of this page within the document.
|
int |
getPageRotation()
Returns the rotation of this page in degrees.
|
float |
getPaperHeight()
Returns the paper's height of this page in 72 DPI.
|
float |
getPaperWidth()
Returns the paper's width of this page in 72 DPI.
|
java.util.Vector<SlimAnnotation> |
getSlimAnnots()
Returns a list of light weight annotations objects.
|
java.lang.String |
getTabbingOrder()
Returns the tabbing order as defined in the page description, if present.
|
com.qoppa.android.pdf.text.TextModel |
getTextModel()
Returns the TextModel for this page
|
boolean |
hasAnnotations()
Returns true if the page contains annotations.
|
boolean |
hasEditableAnnots()
Returns true if the page contains annotations of type other than Widget, Link, and FileAttachment
|
Annotation |
intersectsAnnot(float x,
float y)
Returns the first annotation that contains the x,y point.
|
void |
paintPage(Canvas cv)
Paint the contents of this page to a Canvas.
|
void |
paintPage(Canvas cv,
int bgndColor)
Paints the contents of this page and a background to a Canvas.
|
void |
removeAnnotation(Annotation annot)
Removes an annotation from this page.
|
void |
savePageAsJPEG(java.io.OutputStream outStream,
int dpi,
int quality,
boolean paintAnnotations)
Render the page as an image and save it to the output stream in JPEG format.
|
void |
savePageAsPNG(java.io.OutputStream outStream,
int dpi,
boolean paintAnnotations)
Render the page as an image and save it to the output stream in PNG format.
|
TextSelection |
selectText(RectF rect)
Creates a TextSelection object for any text found in a rectangle.
|
void |
setBackgroundColor(int color)
Sets the background color to use when rendering this page.
|
void |
setPageRotation(int degrees)
Changes this page's rotation.
|
java.lang.String |
useExtGState(double strokeAlpha,
double fillAlpha,
java.lang.String blendName)
Internal method, do not use.
|
java.lang.String |
useFont(PDFFont font)
Internal method, do not use.
|
com.qoppa.android.pdfProcess.util.ImageInfo |
useImage(Bitmap image,
ImageParam params) |
com.qoppa.android.pdfProcess.util.ImageInfo |
useImage(java.lang.String imagePath,
java.lang.String alphaPath) |
public com.qoppa.android.pdf.loObjects.PDFDictionary m_PageDict
public static final int COMPRESSION_JPEG
public static final int COMPRESSION_DEFLATE
public static final int COMPRESSION_JBIG2
public static int DEFAULT_BACKGROUND_COLOR
Color#WHITE
.public boolean hasAnnotations()
getAnnotations()
.public boolean hasEditableAnnots()
public java.util.Vector<Annotation> getAnnotations() throws PDFException
PDFException
public java.util.Vector<SlimAnnotation> getSlimAnnots() throws PDFException
PDFException
public PDFCanvas createCanvas() throws PDFException
PDFException
public com.qoppa.android.pdfProcess.util.ImageInfo useImage(Bitmap image, ImageParam params) throws PDFException
PDFException
public com.qoppa.android.pdfProcess.util.ImageInfo useImage(java.lang.String imagePath, java.lang.String alphaPath) throws PDFException
PDFException
public java.lang.String useFont(PDFFont font) throws PDFException
PDFException
public RectF getCropBox()
public Bitmap getBitmap() throws PDFException
PDFException
public Bitmap getBitmap(int width, int height, boolean paintAnnotations) throws PDFException
width
- The width of the output bitmap.height
- The height of the output bitmap.paintAnnotations
- Boolean indicating if annotations should be paintedPDFException
public Bitmap getBitmap(Rect rect, boolean paintAnnotations) throws PDFException
rect
- The rectangle to renderpaintAnnotations
- Boolean indicating if annotations should be paintedPDFException
public IPicture getIPicture() throws PDFException
PDFException
public void paintPage(Canvas cv, int bgndColor) throws PDFException
cv
- The Canvas object to draw into.PDFException
public void paintPage(Canvas cv) throws PDFException
cv
- The Canvas object to draw into.PDFException
public com.qoppa.android.pdf.util.PeekInputStream getContentStream() throws PDFException
PDFException
public void savePageAsJPEG(java.io.OutputStream outStream, int dpi, int quality, boolean paintAnnotations) throws java.io.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 to 100.paintAnnotations
- Boolean indicating if annotations should be painted
Lower values mean higher compression and lower quality. As a guideline, 25 is low quality, 50 is medium
quality and 75 is high quality.java.io.IOException
PDFException
public void savePageAsPNG(java.io.OutputStream outStream, int dpi, boolean paintAnnotations) throws PDFException, java.io.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.paintAnnotations
- Boolean indicating if annotations should be paintedPDFException
java.io.IOException
public RectF getMediaBox()
public float getPaperHeight()
public float getPaperWidth()
public float getDisplayWidth()
public float getDisplayRight()
public float getDisplayBottom()
public float getDisplayHeight()
public float getDisplayX()
public float getDisplayY()
public Matrix getMirror()
public int getPageRotation()
public void setPageRotation(int degrees)
degrees
- The new page rotation, in degreespublic com.qoppa.android.pdf.loObjects.PDFDictionary getPageDict()
public PDFDocument getDocument()
public void addAnnotation(Annotation annot) throws PDFException
annot
- The annotation to add.PDFException
public int getPageIndex()
public void removeAnnotation(Annotation annot) throws PDFException
annot
- A reference to the annotation that needs to be removed.PDFException
public void deleteAnnotations() throws PDFException
PDFException
public void flattenAnnotations(boolean paintNonPrintableAnnots) throws PDFException
paintNonPrintableAnnots
- Flag to indicate whether non-printable annotations should be painted or not.PDFException
public Annotation intersectsAnnot(float x, float y) throws PDFException
x
- The X coordinate of the point of interest.y
- The Y coordinate of the point of interest.PDFException
public java.lang.String getTabbingOrder()
public PointF convPoint(float x, float y)
x
- The X location of the pointy
- The Y location of the pointpublic RectF convRect(RectF toConv)
toConv
- The rectangle to convertpublic com.qoppa.android.pdf.text.TextModel getTextModel()
public java.lang.String getAllText()
getTextModel()
.public com.qoppa.android.pdf.text.AsyncTextModel getAsyncTextModel()
public TextSelection selectText(RectF rect)
rect
- The rectangle of interest.public java.util.List<TextPosition> findTextOccurrences(java.lang.String searchString)
searchString
- The string to search for.public java.util.List<TextPositionWithContext> findTextOccurrencesWithContext(java.lang.String searchString)
public java.lang.String useExtGState(double strokeAlpha, double fillAlpha, java.lang.String blendName) throws PDFException
PDFException
public SignatureField addSignatureField(java.lang.String fieldName, RectF 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.PDFException
public void setBackgroundColor(int color)
DEFAULT_BACKGROUND_COLOR
will be used.color
- The background color.public int getBackgroundColor()
setBackgroundColor(int)
.