InstantPdfFragment

Fragment that actually displays instant PDF document. It contains only the document view without any additional views like outline, thumbnail bar, search, etc. Meant to be used if you want full custom implementation and design.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Companion object containing factory methods and constants for InstantPdfFragment.

Properties

Link copied to clipboard
Link copied to clipboard
open override val document: InstantPdfDocument?
Link copied to clipboard
open override val undoManager: UndoManager

Functions

Link copied to clipboard

Adds a InstantDocumentListener for instant document events. Listeners added with this method will be removed automatically in .onDetach. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard

Returns manager for annotation preferences.

Link copied to clipboard
open override fun getDocument(): InstantPdfDocument?

Gets the loaded document.

Link copied to clipboard
open override fun getUndoManager(): UndoManager

Returns this fragment's undo manager instance for performing undo/redo operations of annotation edits.

Link copied to clipboard
open override fun onAttach(context: Context)

Called when the fragment is attached to its host context.

Link copied to clipboard
open override fun onAuthenticationFailed(instantDocument: InstantPdfDocument, error: InstantException)

Called when authentication with Instant Server (Nutrient Document Engine) has failed.

Link copied to clipboard
open override fun onAuthenticationFinished(instantDocument: InstantPdfDocument, validJwt: String)

Called when authentication with Instant Server (Nutrient Document Engine) has successfully finished.

Link copied to clipboard
open override fun onCreate(savedInstanceState: Bundle?)

Called when the fragment is first created. Initializes the document source from arguments.

Link copied to clipboard
open override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?

Creates and returns the view hierarchy associated with the fragment.

Link copied to clipboard
open override fun onDestroy()

Called when the fragment is destroyed. Removes the instant document listener.

Link copied to clipboard
open override fun onDetach()

Called when the fragment is detached from its host context. Clears document listeners.

Link copied to clipboard
open override fun onDocumentCorrupted(instantDocument: InstantPdfDocument)

Called when InstantPdfDocument has detected data corruption.

Link copied to clipboard
open override fun onDocumentInvalidated(instantDocument: InstantPdfDocument)

Called when InstantPdfDocument becomes invalid. Any future instant operations on this document will fail.

Link copied to clipboard
open override fun onDocumentLoaded(document: PdfDocument)

Called when document is successfully loaded and the document view has been laid out. This has to be called on the main thread.

Link copied to clipboard
open override fun onDocumentStateChanged(instantDocument: InstantPdfDocument, state: InstantDocumentState)

Called when the document changes its state.

Link copied to clipboard
open override fun onResume()

Called when the fragment becomes visible. Starts listening for server changes if enabled.

Link copied to clipboard
open override fun onStop()

Called when the fragment is no longer visible. Stops listening for server changes.

Link copied to clipboard
open override fun onSyncError(instantDocument: InstantPdfDocument, error: InstantException)

Called when annotation sync has been finished with an error.

Link copied to clipboard
open override fun onSyncFinished(instantDocument: InstantPdfDocument)

Called when annotation sync has been finished successfully.

Link copied to clipboard
open override fun onSyncStarted(instantDocument: InstantPdfDocument)

Called when annotation sync has been started.

Link copied to clipboard

Removes a previously added InstantDocumentListener. After calling this method the listener will stop receiving instant document events. If the listener has not been added previously, this method will be a no-op. Passing null is not allowed, and will result in an exception.

Link copied to clipboard
open override fun save(): Boolean

Saves the annotations in opened document back to Instant Server (Nutrient Document Engine). Blocks until completed when not called on the main thread. If invoked on the main thread, the sync is started asynchronously to avoid ANRs.

Link copied to clipboard
open override fun saveAsync()

Saves the annotations in opened document back to Instant Server (Nutrient Document Engine) asynchronously.

Link copied to clipboard
open override fun setCustomPdfSource(source: DocumentSource)

Sets the custom source for the PDF file.

Link copied to clipboard
open override fun setCustomPdfSources(sources: List<DocumentSource>)

Sets the custom sources for the PDF file.

Link copied to clipboard
fun setHandleCriticalInstantErrors(showCriticalErrors: Boolean)

Sets whether the fragment should automatically handle certain critical Instant errors.

Link copied to clipboard
fun setListenToServerChangesWhenVisible(listenToServerChangesWhenVisible: Boolean)

Controls whether to listen to server changes for loaded document when the fragment is resumed.

Link copied to clipboard
open override fun setOverlaidAnnotationTypes(overlayAnnotationTypes: EnumSet<ERROR CLASS: Symbol not found for AnnotationType>)

Sets annotation types that should be rendered as overlays.

Link copied to clipboard

Starts syncing annotations back to Instant Server (Nutrient Document Engine).