getCurrentPdfViewCtrlFragment is coming null

Product:PDFTron Android SDK

Product Version:Latest

Please give a brief summary of your issue:
I have used custom class which extends PdfViewCtrlTabHostFragment2.
When i fetch this.currentPdfViewCtrlFragment, the result is coming null.
(Think of this as an email subject)

Please describe your issue and provide steps to reproduce it: I have used
private fun addViewerFragment(
@IdRes fragmentContainer: Int,
activity: AppCompatActivity
): PdfViewCtrlTabHostFragment2 {
val file = Utils.copyResourceToLocal(this, R.raw.surfacingmarkup, “untitled”, “.pdf”)
mPdfDoc = PDFDoc(file.absolutePath)
// Create the viewer fragment
val fragment = ViewerBuilder2

    // Add the fragment to the layout fragment container
        .replace(fragmentContainer, fragment)

    return fragment

class PdfFragment : PdfViewCtrlTabHostFragment2() {

override fun onCreateView(
    inflater: LayoutInflater, container: ViewGroup?,
    savedInstanceState: Bundle?
): View? {
    // Inflate the layout for this fragment
    val view = inflater.inflate(R.layout.fragment_pdf, container, false)
    return view


(The more descriptive your answer, the faster we are able to help you)

Please provide a link to a minimal sample where the issue is reproducible:


This call needs to happen after the onDocumentLoaded() event.
Please see here for more info: onDocumentLoaded

Best Regards,