EditablePdfDocument


interface EditablePdfDocument : PdfDocument


Represents a PDF document that allows for editing.

Summary

Public functions

suspend Unit

Applies the changes specified by record to the form.

PdfWriteHandle

Creates a PdfWriteHandle which can be used to save the document to a ParcelFileDescriptor.

Inherited functions

From java.lang.AutoCloseable
From androidx.pdf.PdfDocument
Unit

Adds a listener to receive notifications when some regions of the PDF content are invalidated.

suspend List<FormWidgetInfo>
getFormWidgetInfos(pageNum: Int, types: Long)

Returns the list of FormWidgetInfo on pageNum, optionally filtered by widget type.

PdfDocument.BitmapSource
getPageBitmapSource(pageNumber: Int)

Gets a BitmapSource for retrieving bitmap representations of the specified page.

suspend PdfDocument.PdfPageContent?
getPageContent(pageNumber: Int)

Asynchronously retrieves the content (text and images) of the specified page.

suspend PdfDocument.PageInfo
getPageInfo(pageNumber: Int)

Asynchronously retrieves information about the specified page.

suspend PdfDocument.PageInfo
getPageInfo(pageNumber: Int, pageInfoFlags: Long)

Asynchronously retrieves information about the specified page.

suspend List<PdfDocument.PageInfo>
getPageInfos(pageRange: IntRange)

Asynchronously retrieves information about a range of pages.

suspend List<PdfDocument.PageInfo>
getPageInfos(pageRange: IntRange, pageInfoFlags: Long)

Asynchronously retrieves information about a range of pages.

suspend PdfDocument.PdfPageLinks
getPageLinks(pageNumber: Int)

Asynchronously retrieves the links (Go To and external) present on the specified page.

suspend PageSelection?
getSelectionBounds(pageNumber: Int, start: PointF, stop: PointF)

Asynchronously retrieves the selection bounds (in PDF coordinates) for the specified text selection.

Unit

Removes the listener from the list of listeners which are notified when some regions of the PDF content are invalidated.

suspend SparseArray<List<PageMatchBounds>>
searchDocument(query: String, pageRange: IntRange)

Asynchronously searches the document for the specified query within a range of pages.

Inherited properties

From androidx.pdf.PdfDocument
Int

The type of form present in the document.

Boolean

This property is deprecated. Deprecated, Use linearizationStatus instead

Int

Indicates the linearization status of the document.

Int

The total number of pages in the document.

RenderParams

The render params used to determine the contents that will be rendered on the bitmap.

Uri

The URI of the document represented by this object

Public functions

applyEdit

Added in 1.0.0-alpha16
suspend fun applyEdit(record: FormEditInfo): Unit

Applies the changes specified by record to the form.

Any areas which are invalidated due to this operation are notified via OnPdfContentInvalidatedListener callback.

It is recommended to maintain a list of androidx.pdf.models.FormEditInfo applied to the document so they can be saved and restored across destructive events like low memory kills or configuration changes.

Parameters
record: FormEditInfo

The androidx.pdf.models.FormEditInfo to apply to the form.

Throws
IllegalArgumentException

if the provided record cannot be applied to the widget indicated by the index, or if the index does not correspond to a widget on the page.

createWriteHandle

Added in 1.0.0-alpha16
fun createWriteHandle(): PdfWriteHandle

Creates a PdfWriteHandle which can be used to save the document to a ParcelFileDescriptor.