FormProviderImpl

class FormProviderImpl : InternalFormProvider

Internal implementation of the form provider that manages PDF form fields and elements. This class handles form field creation, retrieval, modification, and removal operations for AcroForms in PDF documents.

Properties

Link copied to clipboard
open override val formCache: FormCache

Returns lazily initialized form fields/elements cache. This can block for a while when initializing cache.

Link copied to clipboard
open override val formElements: List<FormElement>
Link copied to clipboard
open override val formElementsAsync: Single<List<FormElement>>
Link copied to clipboard
open override val formFields: List<FormField>
Link copied to clipboard
open override val formFieldsAsync: Single<List<FormField>>
Link copied to clipboard
val formObserver: FormObserver

Observer translating native form callbacks to Java listeners.

Link copied to clipboard
open override val tabOrder: List<FormElement>
Link copied to clipboard
open override val tabOrderAsync: Single<List<FormElement>>

Functions

Link copied to clipboard
open override fun <T : FormElementConfiguration<*, *>> addFormElementsToPage(fullyQualifiedName: String, formElementConfigurations: List<T>): FormField

Allows to programmatically create and insert a form field into the document. The newly created form field will be automatically attached to the document once created.

Link copied to clipboard
open override fun <T : FormElementConfiguration<*, *>> addFormElementsToPageAsync(fullyQualifiedName: String, formElementConfigurations: List<T>): Single<FormField>

Allows to programmatically create and insert a form field into the document, asynchronously. The newly created form field will be automatically attached to the document once created.

Link copied to clipboard
open override fun <T : FormElementConfiguration<*, *>> addFormElementToPage(fullyQualifiedName: String, formElementConfiguration: T): FormField

Allows to programmatically create and insert a form field into the document.

Link copied to clipboard
open override fun <T : FormElementConfiguration<*, *>> addFormElementToPageAsync(fullyQualifiedName: String, formElementConfiguration: T): Single<FormField>

Allows to programmatically create and insert a form field into the document, asynchronously.

Link copied to clipboard

Adds OnButtonFormFieldUpdatedListener to get notified when button fields get updated. 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

Adds OnChoiceFormFieldUpdatedListener to get notified when choice fields get updated. 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

Adds OnFormFieldUpdatedListener to get notified when any form field gets updated. 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

Adds OnFormTabOrderUpdatedListener to get notified when form tab order has been recalculated. 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

Adds OnTextFormFieldUpdatedListener to get notified when text fields get updated. 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
open override fun attachFormElement(formField: FormField, formElements: List<FormElement>)

Attaches the form field to its child form elements. This method needs to be implemented by the InternalFormProvider because it's package private on the FormField.

Link copied to clipboard
open override fun createFormElement(formField: FormField, annotation: WidgetAnnotation): FormElement

Factory for creating FormElement instances. This is implement by this interface to not expose the form element constructors themselves.

Link copied to clipboard
open override fun createFormField(providerIndex: Int, nativeFormField: ERROR CLASS: Symbol not found for NativeFormField): FormField

Factory for creating FormField instances. This is implement by this interface to not expose the form field constructors themselves.

Link copied to clipboard

Finds a form element for widget annotation.

Link copied to clipboard
open override fun getFormElementForAnnotationAsync(annotation: WidgetAnnotation): Maybe<FormElement>

Finds a form element for widget annotation, asynchronously.

Link copied to clipboard
open override fun getFormElements(): List<FormElement>

Returns a list of all form elements in the document.

Link copied to clipboard
open override fun getFormElementsAsync(): Single<List<FormElement>>

Returns a list of all form elements in the document, asynchronously.

Link copied to clipboard
open override fun getFormElementWithName(fieldName: String): FormElement?

Searches for a form element by name. Returns the first element with given name.

Link copied to clipboard
open override fun getFormElementWithNameAsync(fieldName: String): Maybe<FormElement>

Searches for a form element with a given name, asynchronously.

Link copied to clipboard
open override fun getFormFields(): List<FormField>

Returns a list of all form fields in the document.

Link copied to clipboard
open override fun getFormFieldsAsync(): Single<List<FormField>>

Returns the list of all form fields in the document, asynchronously.

Link copied to clipboard
open override fun getFormFieldWithFullyQualifiedName(fullyQualifiedName: String): FormField?

Searches for a form field with fully qualified field name. Returns the first field with given fullyQualifiedName.

Link copied to clipboard
open override fun getFormFieldWithFullyQualifiedNameAsync(fullyQualifiedName: String): Maybe<FormField>

Searches for a form field with fully qualified field name, asynchronously.

Link copied to clipboard
open override fun getTabOrder(): List<FormElement>

Returns order of FormElement for document. We calculate the tab order with two different methods:

Link copied to clipboard
open override fun getTabOrderAsync(): Single<List<FormElement>>

Returns order of FormElement for document, asynchronously.

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

Returns true when fields cache has already been initialized.

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

Returns whether form fields in this document were modified or not.

Link copied to clipboard
open override fun markFormAsSavedToDisk()

Clears dirty state of this forms provider. It's used to clear the modified state after the document has been saved.

Link copied to clipboard
open override fun onFormFieldAdded(@IntRange(from = 0) providerIndex: Int, nativeFormField: ERROR CLASS: Symbol not found for NativeFormField): FormField?

Call this method to add new field to cache. Use case for this is that, form field has been encountered in document that is not in global AcroForms array and core notifies us about this field.

Link copied to clipboard
open suspend override fun prepareFieldsCache()

Called when the form fields cache should be prepared for the first time. This can take a while and should not be executed on the main thread.

Link copied to clipboard
open override fun removeFormElementFromPage(formElement: FormElement): Boolean

Allows to programmatically remove a form element from the document.

Link copied to clipboard
open override fun removeFormElementFromPageAsync(formElement: FormElement): Single<Boolean>

Allows to programmatically remove a form element from the document, asynchronously.

Link copied to clipboard

Removes previously registered OnButtonFormFieldUpdatedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Passing null is not allowed, and will result in an exception.

Link copied to clipboard

Removes previously registered OnChoiceFormFieldUpdatedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Passing null is not allowed, and will result in an exception.

Link copied to clipboard

Removes previously registered OnFormFieldUpdatedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Passing null is not allowed, and will result in an exception.

Link copied to clipboard

Removes previously registered OnFormTabOrderUpdatedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Passingnull is not allowed, and will result in an exception.

Link copied to clipboard

Removes previously registered OnTextFormFieldUpdatedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, 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 resetFormFields(formFields: List<FormField>, shouldExcludeFormFields: Boolean)

Resets a form, represented by a list of form fields, to default values.

Link copied to clipboard
open override fun setDirty(isDirty: Boolean)

Sets dirty state for this provider.