RadaeePDF.com :: Topic: Land on a different page in Viewer (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: Land on a different page in Viewer

Land on a different page in Viewer 2 years 7 months ago #8796

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.
The administrator has disabled public write access.

Land on a different page in Viewer 2 years 7 months ago #8797

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 711
  • Thank you received: 49
  • Karma: 18
You can achieve this by calling goto method after openning the document:
m_reader.PDFGotoPage(index);
Last Edit: 2 years 7 months ago by nermeen.
The administrator has disabled public write access.

Land on a different page in Viewer 2 years 7 months ago #8798

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());
}
The administrator has disabled public write access.

Land on a different page in Viewer 2 years 7 months ago #8799

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 711
  • Thank you received: 49
  • Karma: 18
It should be after your method is executed:
//your method call
class.PDFOpen(.., .., ,,);
//call goto
m_reader.PDFGotoPage(index);
The administrator has disabled public write access.

Land on a different page in Viewer 2 years 7 months ago #8800

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());
}
The administrator has disabled public write access.

Land on a different page in Viewer 2 years 7 months ago #8801

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 711
  • Thank you received: 49
  • Karma: 18
as said before, after PDFOpen has been executed completely...

Example from the demo project:
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
The administrator has disabled public write access.
Powered by Kunena Forum