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?) {

    pdfView = (findViewById(
    notice_back_arrow.setOnClickListener {

    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,
            var ItemModel = itemDetails.get(position)
            Toast.makeText(this@NoticeActivity, "Clicked on item " + position, Toast.LENGTH_SHORT).show()
            /*  PassedList.clear()
             //  PassedList.add(userCartList)
             println("Bundle Name " + PassedList.get(0).itemName)
             println("Bundle Link " + PassedList.get(0).link1)
             i.putExtra("model", PassedList)*/
            /*var detailsIntent = Intent(this@MainActivity,



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


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.