RadaeePDF.com :: Topic: Get pdf view area - android (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: Get pdf view area - android

Get pdf view area - android 3 years 8 months ago #4977

  • vym
  • vym's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Karma: 0
Hi,

I need to get pdf viewing area to send to another device so that i can move it on another device.

Please help in following 2 questions:
1. How to get current showing part of PDF (If zoom, or left/right scrolled)
2. If i share that data of 1 device to other how to set in another device for same pdf.

Its urgent. Any help is appreciated.

Thank.
The administrator has disabled public write access.

Get pdf view area - android 3 years 8 months ago #4993

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 683
  • Thank you received: 40
  • Karma: 18
Try the following:
You can get the view area values from PDFReader.OnPDFPageDisplayed
System.err.println("left = " + vpage.GetVX(m_view.vGetX()));
System.err.println("top = " + vpage.GetVY(m_view.vGetY()));
System.err.println("right = " + (vpage.GetVX(m_view.vGetX()) +  vpage.GetWidth()));
System.err.println("bottom = " + (vpage.GetVY(m_view.vGetY())+ vpage.GetHeight()));
System.err.println("zoom = " + m_view.vGetScale());

To jump to certain position try (the values i'm using below are the ones read from OnPDFPageDisplayed:
PDFGotoPage(1);
PDFSetScale(3.117f); //zoom = m_view.vGetScale()
new Handler().postDelayed(new Runnable() {
			
	public void run() {
				
		PDFVPage vPage = m_view.vGetPage(1);
		vPage.m_x = -460; // left = vpage.GetVX(m_view.vGetX())
		vPage.m_y = -1104; // top = vpage.GetVY(m_view.vGetY())
	}
}, 500);
The administrator has disabled public write access.

Get pdf view area - android 3 years 8 months ago #5005

  • vym
  • vym's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Karma: 0
Hi,
Thanks a lot for ur answer. It is really helpful and how i needed for getting viewing area.

But I am not able to jump to certain position. As u directed I tried

DFVPage vPage = m_view.vGetPage(1);
vPage.m_x = -460; // left = vpage.GetVX(m_view.vGetX())
vPage.m_y = -1104; // top = vpage.GetVY(m_view.vGetY())

But for vPage.m_x = -460; I am getting 'The field PDFVPage.m_x is not visible' and same for m_y.
How can I achieve that?

Thanking you in anticipation.
The administrator has disabled public write access.

Get pdf view area - android 3 years 8 months ago #5007

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
do you mean synchronize reading in 2 devices?
you can get position by PDFView.vGetPos() in PDFReader like:
PDFPos pos = PDFView.vGetPos(0,0);
and set position on another device:
PDFView.vSetPos(pos, 0, 0);
Notice:
vGetPos and vSetPos can be invoked after first PDFReader.onSizeChanged() called.
The administrator has disabled public write access.

Get pdf view area - android 3 years 8 months ago #5009

  • vym
  • vym's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Karma: 0
Yes, in another device but as in your first comment you provided solution

DFVPage vPage = m_view.vGetPage(1);
vPage.m_x = -460;
vPage.m_y = -1104;

But i am not able to access that m_x and m_y so that i can scroll it to that x,y.

For vPage.m_x = -460; I am getting 'The field PDFVPage.m_x is not visible' and same for m_y.

Thanks.
The administrator has disabled public write access.

Get pdf view area - android 3 years 8 months ago #5010

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 683
  • Thank you received: 40
  • Karma: 18
If you have professional/premium license, you need to modify the visibility of these variables in PDFVPage class or create get/set methods
The administrator has disabled public write access.
Powered by Kunena Forum