Hi,
I'm trying to show the pdf in a view in my activity (I would prefer to avoid using PDFViewAct.java because I will also need to integrate the pdf viewing in a fragment), and I have the following code:
class MainActivity : AppCompatActivity() {
private var m_view: com.radaee.reader.PDFLayoutView? = null
private var m_doc: com.radaee.pdf.Document? = null
private var m_layout: RelativeLayout? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
m_layout = LayoutInflater.from(this).inflate(R.layout.activity_main, null) as RelativeLayout
com.radaee.pdf.Global.Init(this)
m_view = findViewById(R.id.pdf_view)
m_doc = com.radaee.pdf.Document()
m_doc?.Open("/sdcard/Download/Dummy.pdf", "")
m_view?.PDFOpen(m_doc, mpdfLayoutListener)
}
where R.layout.activity_main is this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.radaee.reader.PDFLayoutView
android:id="@+id/pdf_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
</com.radaee.reader.PDFLayoutView>
</RelativeLayout>
The PDF however is not showing:
What I'm doing wrong?
The same pdf with you application PDFSample is showing.
Do you have a more complete example of an application? I will need to search some text in the pdf and PDFSample does not provide the way to do it.
Thank you