- Posts: 814
- Thank you received: 65
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
Convert PDF coordinates to view layout coord
IP: 192.168.0.71
8 years 5 months ago #13007
by Davide
Replied by Davide on topic Convert PDF coordinates to view layout coord
Hi,
can you reproduce the issue with the demo project?
I can get the proper result in the onPostExecute() method of PDFViewAct :
can you reproduce the issue with the demo project?
I can get the proper result in the onPostExecute() method of PDFViewAct :
Code:
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();
IP: 192.168.0.71
8 years 5 months ago #13008
by geertvm
Replied by geertvm on topic Convert PDF coordinates to view layout coord
Not really...but can you indicate what's missing or wrong in the provided code?
IP: 192.168.0.71
8 years 5 months ago #13009
by geertvm
Replied by geertvm on topic Convert PDF coordinates to view layout coord
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();
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();
IP: 192.168.0.71
8 years 5 months ago #13010
by geertvm
Replied by geertvm on topic Convert PDF coordinates to view layout coord
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"
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"
IP: 192.168.0.71
8 years 5 months ago #13011
by nermeen
Replied by nermeen on topic Convert PDF coordinates to view layout coord
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?
IP: 192.168.0.71
8 years 5 months ago #13015
by geertvm
Replied by geertvm on topic Convert PDF coordinates to view layout coord
Hi,
The demoproject can be downloaded from
www.dropbox.com/s/gphhpuwyl8nvmkd/PdfView.zip?dl=0
(Could not upload it...)
Thanks
The demoproject can be downloaded from
www.dropbox.com/s/gphhpuwyl8nvmkd/PdfView.zip?dl=0
(Could not upload it...)
Thanks
Time to create page: 0.385 seconds