Barteksc's android pdf reader can't be detected by kotlin class?

I've tried using barteksc's pdf reader for my android app.It works fine when the code is written in Java.However,whenever I try doing the same thing with Kotlin(same project, different activity), The pdfviewer element in the layout cannot be detected for use. Below is the code I'm using.

class NoticeActivity : AppCompatActivity() {

public lateinit var pdfView: PDFView

val itemDetails = ArrayList<Notice_item_model>()


override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.notice_layout)

    pdfView = (findViewById(R.id.pdf_notice))
    notice_back_arrow.setOnClickListener {
        super.onBackPressed()
    }



    notice_recycler.layoutManager = LinearLayoutManager(this)
    notice_recycler.adapter = LinearRecyclerAdapter(itemDetails, this)
    notice_recycler.addOnItemTouchListener(RecyclerViewTouchListener(getApplicationContext(), notice_recycler, object : RecyclerViewClickListener {
        override fun onClick(view: View, position: Int) {

            val i = Intent(this@NoticeActivity, DetailedActivity::class.java)
            var ItemModel = itemDetails.get(position)
            Toast.makeText(this@NoticeActivity, "Clicked on item " + position, Toast.LENGTH_SHORT).show()
            /*  PassedList.clear()
             PassedList.add(ItemModel)
             //  PassedList.add(userCartList)
             println("Bundle Name " + PassedList.get(0).itemName)
             println("Bundle Link " + PassedList.get(0).link1)
             i.putExtra("model", PassedList)*/
            startActivity(i)
            /*var detailsIntent = Intent(this@MainActivity, ItemDetailsPage::class.java)
            startActivity(detailsIntent)*/

        }

    }))
}


class RetrievePDF : AsyncTask<String, Void, InputStream>() {
    lateinit var inputStream: InputStream
    override fun doInBackground(vararg strings: String): InputStream? {
        try {
            val url = URL(strings[0])
            val urlConnection = url.openConnection() as HttpURLConnection
            if (urlConnection.getResponseCode() === 200) {
                inputStream = BufferedInputStream(urlConnection.getInputStream())
            }
        } catch (e: IOException) {
            return null
        }
        return inputStream
    }

    override fun onPostExecute(inputStream: InputStream) {
       // pdfView.fromStream(inputStream).load()
       // pdfView.setVisibility(View.VISIBLE)
      }
}

}

I'm supposed to write in the postExecute() the below lines

pdfView.fromStream(inputStream).load()
pdfView.setVisibility(View.VISIBLE)

However, when I type the variable"pdfView" or the name of the pdf viewer element from the layout, it doesn't detect it and I can't implement the functions to open the pdf.Would be very glad if someone could help me out with this.