How to invoke search UI in the PdfActivity programatically

If you want to show search view and/or start search in the search view you can use the following method in PdfActivity.

You’ll need to register PSPDFKit views visibility change listener in order to start search immediately after search view is shown:

pspdfKitViews.addOnVisibilityChangedListener(object : OnVisibilityChangedListener {
    override fun onShow(view: View) {
        if (view is PdfSearchViewInline) {
            view.setInputFieldText("query", true)
        } else if (view is PdfSearchViewModular) {
            view.setInputFieldText("query", true)

    override fun onHide(view: View) {

You can then show the search view via:


If you want to invoke search programatically or if you want to build custom search UI take a look at our text search guide that explains all aspects of search and its integration in your UI.