Pdf is not showing on PDFLayoutView - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Pdf is not showing on PDFLayoutView 2 weeks 1 day ago #15304

  • simone.p
  • simone.p's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
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
Attachments:

Please Log in or Create an account to join the conversation.

Pdf is not showing on PDFLayoutView 2 weeks 1 day ago #15305

  • simone.p
  • simone.p's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
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

Please Log in or Create an account to join the conversation.

Pdf is not showing on PDFLayoutView 2 weeks 1 day ago #15307

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1019
  • Karma: 43
  • Thank you received: 53
        //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.
        }
The following user(s) said Thank You: simone.p

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum