PdfDocument
public interface PdfDocument extends Closeable
Represents a PDF document and provides methods to interact with its content.
Summary
Nested types |
|---|
public interface PdfDocument.BitmapSource extends CloseableA source for retrieving bitmap representations of PDF pages. |
public final class PdfDocument.PageInfoRepresents information about a single page in the PDF document. |
public final class PdfDocument.PdfPageContentRepresents the combined text and image content within a single page of a PDF document. |
public final class PdfDocument.PdfPageLinksRepresents the links within a single page of a PDF document. |
Public methods |
|
|---|---|
abstract @NonNull PdfDocument.BitmapSource |
getPageBitmapSource(int pageNumber)Gets a |
abstract PdfDocument.PdfPageContent |
getPageContent(int pageNumber)Asynchronously retrieves the content (text and images) of the specified page. |
abstract int |
The total number of pages in the document. |
abstract @NonNull PdfDocument.PageInfo |
getPageInfo(int pageNumber)Asynchronously retrieves information about the specified page. |
abstract @NonNull List<@NonNull PdfDocument.PageInfo> |
getPageInfos(@NonNull IntRange pageRange)Asynchronously retrieves information about a range of pages. |
abstract @NonNull PdfDocument.PdfPageLinks |
getPageLinks(int pageNumber)Asynchronously retrieves the links (Go To and external) present on the specified page. |
abstract PageSelection |
getSelectionBounds(Asynchronously retrieves the selection bounds (in PDF coordinates) for the specified text selection. |
abstract @NonNull Uri |
getUri()The URI of the document represented by this object |
abstract boolean |
Indicates whether the document is linearized (optimized for fast web viewing). |
abstract @NonNull SparseArray<@NonNull List<@NonNull PageMatchBounds>> |
searchDocument(@NonNull String query, @NonNull IntRange pageRange)Asynchronously searches the document for the specified query within a range of pages. |
Inherited methods |
||
|---|---|---|
|
Public methods
getPageBitmapSource
abstract @NonNull PdfDocument.BitmapSource getPageBitmapSource(int pageNumber)
Gets a BitmapSource for retrieving bitmap representations of the specified page.
| Parameters | |
|---|---|
int pageNumber |
The page number (0-based). |
| Returns | |
|---|---|
@NonNull PdfDocument.BitmapSource |
A |
getPageContent
abstract PdfDocument.PdfPageContent getPageContent(int pageNumber)
Asynchronously retrieves the content (text and images) of the specified page.
| Parameters | |
|---|---|
int pageNumber |
The page number (0-based). |
| Returns | |
|---|---|
PdfDocument.PdfPageContent |
A |
getPageCount
abstract int getPageCount()
The total number of pages in the document.
getPageInfo
abstract @NonNull PdfDocument.PageInfo getPageInfo(int pageNumber)
Asynchronously retrieves information about the specified page.
| Parameters | |
|---|---|
int pageNumber |
The page number (0-based). |
| Returns | |
|---|---|
@NonNull PdfDocument.PageInfo |
A |
getPageInfos
abstract @NonNull List<@NonNull PdfDocument.PageInfo> getPageInfos(@NonNull IntRange pageRange)
Asynchronously retrieves information about a range of pages.
| Returns | |
|---|---|
@NonNull List<@NonNull PdfDocument.PageInfo> |
A list of |
getPageLinks
abstract @NonNull PdfDocument.PdfPageLinks getPageLinks(int pageNumber)
Asynchronously retrieves the links (Go To and external) present on the specified page.
| Parameters | |
|---|---|
int pageNumber |
The page number (0-based). |
| Returns | |
|---|---|
@NonNull PdfDocument.PdfPageLinks |
A |
getSelectionBounds
abstract PageSelection getSelectionBounds(
int pageNumber,
@NonNull PointF start,
@NonNull PointF stop
)
Asynchronously retrieves the selection bounds (in PDF coordinates) for the specified text selection.
| Parameters | |
|---|---|
int pageNumber |
The page on which text to be selected. |
@NonNull PointF start |
The starting point of the text selection. |
@NonNull PointF stop |
The ending point of the text selection. |
| Returns | |
|---|---|
PageSelection |
A |
getUri
abstract @NonNull Uri getUri()
The URI of the document represented by this object
isLinearized
abstract boolean isLinearized()
Indicates whether the document is linearized (optimized for fast web viewing).
searchDocument
abstract @NonNull SparseArray<@NonNull List<@NonNull PageMatchBounds>> searchDocument(@NonNull String query, @NonNull IntRange pageRange)
Asynchronously searches the document for the specified query within a range of pages.
| Parameters | |
|---|---|
@NonNull String query |
The search query string. |
@NonNull IntRange pageRange |
The range of page numbers (0-based, inclusive) to search within. |
| Returns | |
|---|---|
@NonNull SparseArray<@NonNull List<@NonNull PageMatchBounds>> |
A |