Get pdf view area - android - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Get pdf view area - android

Get pdf view area - android 4 years 9 months ago #4977

  • vym
  • vym's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 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.

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

Get pdf view area - android 4 years 9 months ago #4993

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
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);

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

Get pdf view area - android 4 years 9 months ago #5005

  • vym
  • vym's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 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.

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

Get pdf view area - android 4 years 9 months ago #5007

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
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.

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

Get pdf view area - android 4 years 9 months ago #5009

  • vym
  • vym's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 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.

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

Get pdf view area - android 4 years 9 months ago #5010

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
If you have professional/premium license, you need to modify the visibility of these variables in PDFVPage class or create get/set methods

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

  • Page:
  • 1
Powered by Kunena Forum