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

Get pdf view area - android

More
IP: 192.168.0.70 12 years 8 months ago #4977 by vym
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.
More
IP: 192.168.0.158 12 years 8 months ago #4993 by nermeen
Replied by nermeen on topic Get pdf view area - android
Try the following:
You can get the view area values from PDFReader.OnPDFPageDisplayed
Code:
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:
Code:
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);
More
IP: 192.168.0.70 12 years 7 months ago #5005 by vym
Replied by vym on topic Get pdf view area - android
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.
More
IP: 192.168.0.70 12 years 7 months ago #5007 by radaee
Replied by radaee on topic Get pdf view area - android
do you mean synchronize reading in 2 devices?
you can get position by PDFView.vGetPos() in PDFReader like:
Code:
PDFPos pos = PDFView.vGetPos(0,0);
and set position on another device:
Code:
PDFView.vSetPos(pos, 0, 0);
Notice:
vGetPos and vSetPos can be invoked after first PDFReader.onSizeChanged() called.
More
IP: 192.168.0.70 12 years 7 months ago #5009 by vym
Replied by vym on topic Get pdf view area - android
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.
More
IP: 192.168.0.158 12 years 7 months ago #5010 by nermeen
Replied by nermeen on topic Get pdf view area - android
If you have professional/premium license, you need to modify the visibility of these variables in PDFVPage class or create get/set methods
Time to create page: 0.464 seconds
Powered by Kunena Forum