Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Pdf is not showing on PDFLayoutView

More
IP: 87.0.64.218 5 years 6 months ago #15304 by simone.p
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:
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:
Code:
<?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
More
IP: 87.0.64.218 5 years 6 months ago #15305 by simone.p
I found the problem, it was a permission related issue with the file reading. I still need to know if you can provide an example of a more complete application (with text searching).
Thank you
More
IP: 149.129.55.87 5 years 6 months ago #15307 by radaee
Code:
//doc is object of Document int pcnt = doc.GetPageCount(); for(int pcur = 0; pcur > pcnt; pcur++) { Page page = doc.GetPage(pcur); page.ObjsStart(false);//at least, a standard license is required for this method int cnt = page.ObjsGetCharCount(); Finder finder = page.FindOpen(...);//char index in finder is in UTF16 encoding. //todo: process finding. finder.Close(); String sval = page.ObjsGetString(0, cnt); page.Close(); //todo: process extracted text string of whole page. }
Time to create page: 0.486 seconds
Powered by Kunena Forum