Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF

TOPIC:

Convert PDF coordinates to view layout coord 6 years 6 months ago #13007

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
can you reproduce the issue with the demo project?
I can get the proper result in the onPostExecute() method of PDFViewAct :
m_view.PDFOpen(m_doc, PDFViewAct.this);

Page p = m_doc.GetPage0();
p.ObjsStart();
p.GetAnnotCount();
Toast.makeText(PDFViewAct.this, "Annot Count " + p.GetAnnotCount(), Toast.LENGTH_SHORT).show();
p.Close();

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

Convert PDF coordinates to view layout coord 6 years 6 months ago #13008

  • geertvm
  • geertvm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Not really...but can you indicate what's missing or wrong in the provided code?

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

Convert PDF coordinates to view layout coord 6 years 6 months ago #13009

  • geertvm
  • geertvm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Hi,
I can't simulate it in the sample but when I have the next code, the count = 0

Thanks

m_view = (PDFLayoutView) findViewById(R.id.view);
m_asset_stream = new PDFAssetStream();
m_asset_stream.open(getAssets(), "tbs.pdf");

m_doc = new Document();
int ret = m_doc.OpenStream(m_asset_stream, "");
Log.d(TAG, "OpenStream: " + ret);

m_view.PDFOpen(m_doc, null);

Page p = m_doc.GetPage0();
p.ObjsStart();
int c = p.GetAnnotCount();

Log.d(TAG, "Count = " + c);
p.Close();

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

Convert PDF coordinates to view layout coord 6 years 6 months ago #13010

  • geertvm
  • geertvm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Hi,

This is working in the AboutActivity of RDPDFReader


@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Global.Init(this);
m_view = new PDFLayoutView(this);
m_asset_stream = new PDFAssetStream();
m_asset_stream.open(getAssets(), "tbs.pdf");
m_doc = new Document();
int ret = m_doc.OpenStream(m_asset_stream, null);
ProcessOpenResult(ret);
if(ret == 0)
setContentView(m_view);

Page p = m_doc.GetPage0();
p.ObjsStart();
int c = p.GetAnnotCount(); // -> 2
p.Close();
}

This isn’t working

In my MainActivity…

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//setSupportActionBar(toolbar);

Global.Init(this);
m_view = (PDFLayoutView) findViewById(R.id.view);
m_asset_stream = new PDFAssetStream();
m_asset_stream.open(getAssets(), "tbs.pdf");

m_doc = new Document();
int ret = m_doc.OpenStream(m_asset_stream, "");
Log.d(TAG, "OpenStream: " + ret);

m_view.PDFOpen(m_doc, null);

Page p = m_doc.GetPage0();
p.ObjsStart();
int c = p.GetAnnotCount(); // -> 0

Log.d(TAG, "Count = " + c);
p.Close();
}


With

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="schemas.android.com/apk/res/android"
android:id="@+id/ctrllayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.radaee.reader.PDFLayoutView
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/sctoolbar">
</com.radaee.reader.PDFLayoutView>

<RelativeLayout
android:id="@+id/sctoolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/customborder">

<ImageButton
android:id="@+id/arrleft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

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

Convert PDF coordinates to view layout coord 6 years 6 months ago #13011

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
As we cannot reproduce the issue with the demo project, can you send us a sample project (activated with the demo license) that can be used to investigate this problem?

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

Convert PDF coordinates to view layout coord 6 years 6 months ago #13015

  • geertvm
  • geertvm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Hi,

The demoproject can be downloaded from
www.dropbox.com/s/gphhpuwyl8nvmkd/PdfView.zip?dl=0

(Could not upload it...)

Thanks

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

Powered by Kunena Forum