PdfDocument

interface PdfDocument

A PDF document. To create an instance use openDocument or related static methods on the PdfDocumentLoader class.

Inheritors

Types

Link copied to clipboard
Indicates that the returned value is a page rotation.

Properties

Link copied to clipboard
val NO_ROTATION: Int = 0
Rotation value returned for pages that aren't rotated.
Link copied to clipboard
val ROTATION_180: Int = 180
Rotation value returned for pages that are rotated 180°.
Link copied to clipboard
val ROTATION_270: Int = 270
Rotation value returned for pages that are rotated 270°.
Link copied to clipboard
val ROTATION_90: Int = 90
Rotation value returned for pages that are rotated 90°.

Functions

Link copied to clipboard
abstract fun addLongTermValidation(@NonNull signatureFormElement: SignatureFormElement, @NonNull certificates: List<X509Certificate>): Completable
This adds long term validation to an existing signature form element that has already been signed or refreshes that information if the signature is already LTV enabled.
Link copied to clipboard
fun PdfDocument.createTextBlock(@IntRange(from = 0) pageIndex: Int, range: Range): TextBlock

Creates a TextBlock from the given page.

Link copied to clipboard
Returns AnnotationProvider object which handles annotations contained in this document.
Link copied to clipboard
Returns BookmarkProvider object which handles bookmarks contained in this document.
Link copied to clipboard
abstract fun getCharIndexAt(@IntRange(from = 0) pageIndex: Int, x: Float, y: Float): Int
Return the index of the closest character whose rect intersects the given x and y coordinates.
Link copied to clipboard
Returns PdfDocumentCheckpointer object which handles the checkpoint for the document.
Link copied to clipboard
Returns a default set of document save options which have same permissions, password and PDF version set as this document.
Link copied to clipboard
abstract fun getDocumentId(): Array<Byte>
Returns a document identifier.
Link copied to clipboard
abstract fun getDocumentIdString(): String
Returns a string representation of a document identifier.
Link copied to clipboard
Returns information about digital signatures in this document.
Link copied to clipboard
Returns information about digital signatures in this document.
Link copied to clipboard
Returns source of this document.
Link copied to clipboard
Returns list of DocumentSources from which this document is loaded.
Link copied to clipboard
Returns EmbeddedFilesProvider object which handles embedded files contained in this document.
Link copied to clipboard
Returns FormProvider object which handles forms contained in this document.
Link copied to clipboard
abstract fun getHashForDocumentRange(@NonNull range: List<Long>, @NonNull hashAlgorithm: HashAlgorithm): Array<Byte>
abstract fun getHashForDocumentRange(sourceIndex: Int, @NonNull range: List<Long>, @NonNull hashAlgorithm: HashAlgorithm): Array<Byte>
Returns the hash of a particular byte range of the document.
Link copied to clipboard
Returns JavaScriptProvider object which handles JavaScript execution for this document.
Link copied to clipboard
Returns list of top-level (outline / table-of-contents) bookmarks.
Link copied to clipboard
abstract fun getOutlineAsync(): Single<List<OutlineElement>>
Returns list of top-level (outline / table-of-contents) bookmarks, asynchronously.
Link copied to clipboard
Returns the current document's PageBinding.
Link copied to clipboard
abstract fun getPageBox(@IntRange(from = 0) pageIndex: Int, @NonNull box: PdfBox): RectF
Returns rectangle describing one of the PDF page boxes.
Link copied to clipboard
abstract fun getPageCount(): Int
Returns number of pages in this document.
Link copied to clipboard
abstract fun getPageIndexForPageLabel(@NonNull pageLabel: String, partialMatching: Boolean): Integer
Gets the page index for the given page label.
Link copied to clipboard
abstract fun getPageLabel(@IntRange(from = 0) pageIndex: Int, substituteWithPlainLabel: Boolean): String
Gets the page label.
Link copied to clipboard
abstract fun getPageRotation(@IntRange(from = 0) pageIndex: Int): Int
Returns a page rotation in degrees.
Link copied to clipboard
abstract fun getPageSize(@IntRange(from = 0) pageIndex: Int): Size
Returns a page size in PDF points.
Link copied to clipboard
abstract fun getPageText(@IntRange(from = 0) pageIndex: Int): String
Returns text content of the document page.
abstract fun getPageText(@IntRange(from = 0) pageIndex: Int, @NonNull rectF: RectF): String
Returns text content inside given page rectangle.
abstract fun getPageText(@IntRange(from = 0) pageIndex: Int, start: Int, length: Int): String
Returns text content between two character indexes.
Link copied to clipboard
abstract fun getPageTextLength(@IntRange(from = 0) pageIndex: Int): Int
Gets number of characters in text on the page.
Link copied to clipboard
abstract fun getPageTextRects(@IntRange(from = 0) pageIndex: Int, startIndex: Int, length: Int): List<RectF>
abstract fun getPageTextRects(@IntRange(from = 0) pageIndex: Int, startIndex: Int, length: Int, markupPadding: Boolean): List<RectF>
Returns the rects of the range of characters on a page.
Link copied to clipboard
Returns metadata (title, author, creation date, ...) of this document, stored in the PDF document dictionary.
Link copied to clipboard
Returns auxiliary projection class for mapping coordinate space between raw and normalized Pdf.
Link copied to clipboard
Returns current PDF version of the document.
Link copied to clipboard
Returns set of currently applied permission flags on this document.
Link copied to clipboard
abstract fun getRotationOffset(@IntRange(from = 0) pageIndex: Int): Int
Returns the rotation offset applied to this page in degrees.
Link copied to clipboard
Gets the secondary unit value from the document
Link copied to clipboard
abstract fun getTextForBlocks(@NonNull textBlocks: List<TextBlock>): String
Returns page text for a list of text blocks.
Link copied to clipboard
abstract fun getTitle(): String
Returns a document title.
Link copied to clipboard
abstract fun getUid(): String
This is the unique identifier for this document.
Link copied to clipboard
Returns document metadata stored in the XMP metadata entries included in the PDF file.
Link copied to clipboard
abstract fun hasEmbeddedFile(): Boolean
Checks whether this document has embedded files, which includes all the file annotations
Link copied to clipboard
abstract fun hasOutline(): Boolean
Checks whether this document has outline / table of contents
Link copied to clipboard
abstract fun hasPermission(@NonNull permission: DocumentPermissions): Boolean
Test document permission flags.
Link copied to clipboard
abstract fun initPageCache()
Pre-fetches rotations, sizes and labels for all pages on a background thread.
Link copied to clipboard
abstract fun initPageCacheAsync(): Completable
Pre-fetches rotations, sizes and labels for all pages on a background thread.
Link copied to clipboard
abstract fun invalidateCache()
Invalidates the rendered cache of all the pages for this document.
Link copied to clipboard
abstract fun invalidateCacheForPage(@IntRange(from = 0) pageIndex: Int)
Invalidates the rendered cache of the given pageIndex for this document.
Link copied to clipboard
Whether or not automatic link generation is enabled.
Link copied to clipboard
Whether or not watermark filtering is enabled.
Link copied to clipboard
Query whether the document data source is read/write (is not compounded and comes from a supported source) and whether saving is enabled.
Link copied to clipboard
abstract fun renderPageToBitmap(@NonNull context: Context, pageIndex: Int, width: Int, height: Int): Bitmap
abstract fun renderPageToBitmap(@NonNull context: Context, pageIndex: Int, width: Int, height: Int, @NonNull configuration: PageRenderConfiguration): Bitmap
Renders page to a bitmap.
Link copied to clipboard
abstract fun renderPageToBitmapAsync(@NonNull context: Context, pageIndex: Int, width: Int, height: Int): Single<Bitmap>
abstract fun renderPageToBitmapAsync(@NonNull context: Context, @IntRange(from = 0) pageIndex: Int, width: Int, height: Int, @NonNull configuration: PageRenderConfiguration): Single<Bitmap>
Renders page to a bitmap.
Link copied to clipboard
abstract fun save(@NonNull path: String)
abstract fun save(@NonNull path: String, @NonNull saveOptions: DocumentSaveOptions)
Saves the document to an external file even if it hasn't been changed.
Link copied to clipboard
abstract fun saveAsync(@NonNull path: String): Completable
abstract fun saveAsync(@NonNull path: String, @NonNull saveOptions: DocumentSaveOptions): Completable
Saves the document to an external file even if it hasn't been changed.
Link copied to clipboard
abstract fun saveIfModified(): Boolean
abstract fun saveIfModified(@NonNull saveOptions: DocumentSaveOptions): Boolean
Saves the document to original location if it has been changed.
abstract fun saveIfModified(@NonNull path: String): Boolean
abstract fun saveIfModified(@NonNull path: String, @NonNull saveOptions: DocumentSaveOptions): Boolean
Saves the document to passed location if it has been changed.
Link copied to clipboard
abstract fun saveIfModifiedAsync(): Single<Boolean>
abstract fun saveIfModifiedAsync(@NonNull saveOptions: DocumentSaveOptions): Single<Boolean>
Saves the document back to original location if it has been changed.
abstract fun saveIfModifiedAsync(@NonNull path: String): Single<Boolean>
abstract fun saveIfModifiedAsync(@NonNull path: String, @NonNull saveOptions: DocumentSaveOptions): Single<Boolean>
Saves the document to an external file if it has been changed.
Link copied to clipboard
Enables or disables automatic link generation.
Link copied to clipboard
abstract fun setPageBinding(@NonNull pageBinding: PageBinding)
Sets the PageBinding controlling in which direction pages of documents are laid out.
Link copied to clipboard
abstract fun setRotationOffset(pageRotation: Int, @IntRange(from = 0) pageIndex: Int)
Applies a temporary rotation to the specified page of this document.
Link copied to clipboard
abstract fun setRotationOffsets(@NonNull pageRotations: SparseIntArray)
Applies a temporary rotation to the specified pages of this document.
Link copied to clipboard
abstract fun setSecondaryMeasurementUnit(@NonNull secondaryMeasurementUnit: SecondaryMeasurementUnit)
Sets the secondary unit value on the document.
Link copied to clipboard
Enables or disables filtering of watermark text in text retrieval methods.
Link copied to clipboard
abstract fun wasModified(): Boolean
Returns true if this document was modified and should be saved to retain changes.