PdfDocumentEditor

Editor for PDF documents. A document editor can perform operations on a PDF document for page manipulation, reordering and importing documents. Document editor won't directly manipulate the returned document instance but will keep track of all editing steps internally, allowing them to save them back once editing is complete. To create a document editor use createForDocument.

Functions

Link copied to clipboard
abstract fun addPage(@IntRange(from = 0) pageIndex: Int, @NonNull newPageConfiguration: NewPage): Single<List<EditingChange>>
Adds a new page at the specified pageIndex, with the configuration options specified in newPageConfiguration.
Link copied to clipboard
abstract fun addPages(@IntRange(from = 0) pageIndex: Int, @NonNull newPageConfigurations: List<NewPage>): Single<List<EditingChange>>
Adds a new collection of pages at the specified pageIndex, with the configuration options specified in newPageConfigurations for every page.
Link copied to clipboard
abstract fun beginTransaction()
Begins a batch of document editor operations, undoable/redoable as a single unit.
Link copied to clipboard
abstract fun canRedo(): Boolean
Checks if redo operation is possible on document editor.
Link copied to clipboard
abstract fun canUndo(): Boolean
Checks if undo operation is possible on document editor.
Link copied to clipboard
Ends a batch of document editor operations and commits them immediately.
Link copied to clipboard
Discards the current batch of document operations.
Link copied to clipboard
abstract fun duplicatePages(@NonNull pageIndexes: Set<Integer>): Single<List<EditingChange>>
Duplicates pages of the document.
Link copied to clipboard
abstract fun exportPages(@NonNull context: Context, @NonNull outputStream: OutputStream, @NonNull pageIndexes: Set<Integer>, @Nullable options: DocumentSaveOptions): Completable
Exports selected pages to an output stream.
Link copied to clipboard
Returns the original document being edited.
Link copied to clipboard
@IntRange(from = 0)
abstract fun getPageCount(): Int
Returns the page count of the edited document.
Link copied to clipboard
abstract fun getRotatedPageSize(@IntRange(from = 0) pageIndex: Int): Size
Returns page size of a given page already rotated.
Link copied to clipboard
abstract fun importDocument(@NonNull context: Context, @NonNull documentSource: DocumentSource, @IntRange(from = 0) destinationIndex: Int): Single<List<EditingChange>>
Imports all the pages from a given document source to a destination index.
Link copied to clipboard
Checks if there's currently an active document editor transaction.
Link copied to clipboard
abstract fun movePages(@NonNull fromPositions: Set<Integer>, @IntRange(from = 0) toPosition: Int): Single<List<EditingChange>>
Moves a given set of pages of the document to a specific index.
Link copied to clipboard
abstract fun redo(): List<EditingChange>
Perform redo changes on document editor.
Link copied to clipboard
abstract fun removePages(@NonNull pageIndexes: Set<Integer>): Single<List<EditingChange>>
Removes pages from the document.
Link copied to clipboard
abstract fun renderPageToBitmap(@IntRange(from = 0) pageIndex: Int, @NonNull buffer: Bitmap, @NonNull configuration: PageRenderConfiguration): Completable
Renders the given page into a Bitmap buffer.
Link copied to clipboard
abstract fun rotatePages(@NonNull pageIndexes: Set<Integer>, rotation: Int): Single<List<EditingChange>>
Rotate pages of the document.
Link copied to clipboard
abstract fun saveDocument(@NonNull context: Context, @Nullable options: DocumentSaveOptions): Completable
Saves all changes made to the document.
abstract fun saveDocument(@NonNull context: Context, @NonNull outputStream: OutputStream, @Nullable options: DocumentSaveOptions): Completable
Saves all changes made to the document to a given output stream.
Link copied to clipboard
abstract fun setPageLabel(@IntRange(from = 0) pageIndex: Int, @Nullable label: String)
Sets a new page label for the edited document.
Link copied to clipboard
abstract fun undo(): List<EditingChange>
Perform undo changes on document editor.