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

TOPIC:

Land on a different page in Viewer 9 years 2 weeks ago #8796

  • arcmobile.div
  • arcmobile.div's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
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.

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

Land on a different page in Viewer 9 years 2 weeks ago #8797

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
You can achieve this by calling goto method after openning the document:
m_reader.PDFGotoPage(index);

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

Last edit: by nermeen.

Land on a different page in Viewer 9 years 2 weeks ago #8798

  • arcmobile.div
  • arcmobile.div's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
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());
}

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

Land on a different page in Viewer 9 years 2 weeks ago #8799

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
It should be after your method is executed:
//your method call
class.PDFOpen(.., .., ,,);
//call goto
m_reader.PDFGotoPage(index);

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

Land on a different page in Viewer 9 years 2 weeks ago #8800

  • arcmobile.div
  • arcmobile.div's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
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());
}

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

Land on a different page in Viewer 9 years 2 weeks ago #8801

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
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

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

  • Page:
  • 1
Powered by Kunena Forum