- Posts: 80
- Thank you received: 0
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
Land on a different page in Viewer
- arcmobile.div
- Topic Author
- Offline
- Premium Member
-
Less
More
11 years 5 months ago #8796
by arcmobile.div
Land on a different page in Viewer was created by arcmobile.div
When a multipage document is rendered on the device , by default the first page is displayed.
I need to customise the code such that any page of the document can be rendered at the first time.
I need to customise the code such that any page of the document can be rendered at the first time.
11 years 5 months ago - 11 years 5 months ago #8797
by nermeen
Replied by nermeen on topic Land on a different page in Viewer
You can achieve this by calling goto method after openning the document:
Code:
m_reader.PDFGotoPage(index);
Last edit: 11 years 5 months ago by nermeen.
- arcmobile.div
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 80
- Thank you received: 0
11 years 5 months ago #8798
by arcmobile.div
Replied by arcmobile.div on topic Land on a different page in Viewer
From where do we need to call this code ,
m_view.PDFGotoPage(index);
We having the following code for opening the document for the first time:
public void PDFOpen(Document doc, boolean rtol, PDFReaderListener listener,
boolean isLoadCurrentPage, int loadCurrentPageNo) {
PDFClose();
m_listener = listener;
m_doc = doc;
m_rtol = rtol;
int back_color = 0xFFCCCCCC;
switch (Global.def_view) {
case 1: {
PDFViewHorz view = new PDFViewHorz(this.getContext());
view.vSetDirection(m_rtol);
m_view = view;
}
break;
case 2:
m_view = new PDFViewCurl(this.getContext());
back_color = 0xFFFFFFFF;
break;
case 3: {
PDFViewDual view = new PDFViewDual(this.getContext());
boolean paras[] = new boolean[m_doc.GetPageCount()];
int cur = 0;
while (cur < paras.length) {
paras[cur] = false;
cur++;
}
view.vSetLayoutPara(null, paras, m_rtol);
m_view = view;
}
break;
case 4:
case 6: {
PDFViewDual view = new PDFViewDual(this.getContext());
view.vSetLayoutPara(null, null, m_rtol);
m_view = view;
}
break;
default:
m_view = new PDFViewVert(this.getContext());
break;
}
m_view.vOpen(m_doc, 4, back_color, this);
m_view.vResize(getWidth(), getHeight());
}
m_view.PDFGotoPage(index);
We having the following code for opening the document for the first time:
public void PDFOpen(Document doc, boolean rtol, PDFReaderListener listener,
boolean isLoadCurrentPage, int loadCurrentPageNo) {
PDFClose();
m_listener = listener;
m_doc = doc;
m_rtol = rtol;
int back_color = 0xFFCCCCCC;
switch (Global.def_view) {
case 1: {
PDFViewHorz view = new PDFViewHorz(this.getContext());
view.vSetDirection(m_rtol);
m_view = view;
}
break;
case 2:
m_view = new PDFViewCurl(this.getContext());
back_color = 0xFFFFFFFF;
break;
case 3: {
PDFViewDual view = new PDFViewDual(this.getContext());
boolean paras[] = new boolean[m_doc.GetPageCount()];
int cur = 0;
while (cur < paras.length) {
paras[cur] = false;
cur++;
}
view.vSetLayoutPara(null, paras, m_rtol);
m_view = view;
}
break;
case 4:
case 6: {
PDFViewDual view = new PDFViewDual(this.getContext());
view.vSetLayoutPara(null, null, m_rtol);
m_view = view;
}
break;
default:
m_view = new PDFViewVert(this.getContext());
break;
}
m_view.vOpen(m_doc, 4, back_color, this);
m_view.vResize(getWidth(), getHeight());
}
11 years 5 months ago #8799
by nermeen
Replied by nermeen on topic Land on a different page in Viewer
It should be after your method is executed:
Code:
//your method call
class.PDFOpen(.., .., ,,);
//call goto
m_reader.PDFGotoPage(index);
- arcmobile.div
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 80
- Thank you received: 0
11 years 5 months ago #8800
by arcmobile.div
Replied by arcmobile.div on topic Land on a different page in Viewer
Loading a 4 page document and using the PDFReader code of version 3.2
Added the m_view.vGotoPage(3) after the m_view.vOpen(m_doc, 4, back_color, this), its not working.
Its loading the first page and not the third page.
public void PDFOpen(Document doc, boolean rtol, PDFReaderListener listener) {
PDFClose();
m_listener = listener;
m_doc = doc;
m_rtol = rtol;
int back_color = 0xFFCCCCCC;
switch (Global.def_view) {
case 1: {
PDFViewHorz view = new PDFViewHorz(this.getContext());
view.vSetDirection(m_rtol);
m_view = view;
}
break;
case 2:
m_view = new PDFViewCurl(this.getContext());
back_color = 0xFFFFFFFF;
break;
case 3: {
PDFViewDual view = new PDFViewDual(this.getContext());
boolean paras[] = new boolean[m_doc.GetPageCount()];
int cur = 0;
while (cur < paras.length) {
paras[cur] = false;
cur++;
}
view.vSetLayoutPara(null, paras, m_rtol);
m_view = view;
}
break;
case 4:
case 6: {
PDFViewDual view = new PDFViewDual(this.getContext());
view.vSetLayoutPara(null, null, m_rtol);
m_view = view;
}
break;
case 5: {
PDFViewReflow view = new PDFViewReflow(this.getContext());
m_view = view;
}
break;
default: {
PDFViewVert view = new PDFViewVert(this.getContext());
view.vSetPageAlign(1);// center;
m_view = view;
}
break;
}
m_view.vOpen(m_doc, 4, back_color, this);
m_view.vGotoPage(3);
m_view.vResize(getWidth(), getHeight());
}
Added the m_view.vGotoPage(3) after the m_view.vOpen(m_doc, 4, back_color, this), its not working.
Its loading the first page and not the third page.
public void PDFOpen(Document doc, boolean rtol, PDFReaderListener listener) {
PDFClose();
m_listener = listener;
m_doc = doc;
m_rtol = rtol;
int back_color = 0xFFCCCCCC;
switch (Global.def_view) {
case 1: {
PDFViewHorz view = new PDFViewHorz(this.getContext());
view.vSetDirection(m_rtol);
m_view = view;
}
break;
case 2:
m_view = new PDFViewCurl(this.getContext());
back_color = 0xFFFFFFFF;
break;
case 3: {
PDFViewDual view = new PDFViewDual(this.getContext());
boolean paras[] = new boolean[m_doc.GetPageCount()];
int cur = 0;
while (cur < paras.length) {
paras[cur] = false;
cur++;
}
view.vSetLayoutPara(null, paras, m_rtol);
m_view = view;
}
break;
case 4:
case 6: {
PDFViewDual view = new PDFViewDual(this.getContext());
view.vSetLayoutPara(null, null, m_rtol);
m_view = view;
}
break;
case 5: {
PDFViewReflow view = new PDFViewReflow(this.getContext());
m_view = view;
}
break;
default: {
PDFViewVert view = new PDFViewVert(this.getContext());
view.vSetPageAlign(1);// center;
m_view = view;
}
break;
}
m_view.vOpen(m_doc, 4, back_color, this);
m_view.vGotoPage(3);
m_view.vResize(getWidth(), getHeight());
}
11 years 5 months ago #8801
by nermeen
Replied by nermeen on topic Land on a different page in Viewer
as said before, after PDFOpen has been executed completely...
Example from the demo project:
You can also check www.radaeepdf.com/forum/Android-developm...r-in-initialize#7541
Example from the demo project:
Code:
m_reader.PDFOpen(m_doc, false, this);
m_reader.PDFGotoPage(4);
You can also check www.radaeepdf.com/forum/Android-developm...r-in-initialize#7541
Time to create page: 0.417 seconds