OnPDFDoubleTapped parameter - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: OnPDFDoubleTapped parameter

OnPDFDoubleTapped parameter 1 week 2 days ago #14521

  • tommaso
  • tommaso's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0
Hi,
I need to read pdf clicked text (With com.radaee.pdf.Page -> "objs") but I've a problem with pdf position,
On OnPDFDoubleTapped event I receive x,y wrong position,
when device is in portrait the position seems to be upsidedown, when in landscape seems correct but page number returned is always the left page regardless of what I click(com.radaee.reader.PDFGLLayoutView -> "PDFGetDoc").

I've found that vGetPos function return correct values but I can't use it without change library and in any case i can't return the right page Nr from double click event

Have any hint
Thanks in advance
Regards Tommaso Honoré
                final int x = (int)e.getX();
                final int y = (int)e.getY();
                final GLLayout.PDFPos pos = m_layout.vGetPos(x, y);
                m_layout.vSetPos(x, y,  pos);
                Log.e("", "Pagina " + pos.pageno + ".");

                if (m_listener == null || !m_listener.OnPDFDoubleTapped(pos.x, pos.y))
                    return false;

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

OnPDFDoubleTapped parameter 1 week 2 days ago #14524

  • luca.f
  • luca.f's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 23
  • Thank you received: 1
Dear user,
the coordinates you are receiving from the OnPDFDoubleTapped event are screen coordinates, which always have the origin point in the upper left corner.
PDF instead uses a coordinate system with the origin point located in the bottom left corner.
vGetPos already does this conversion for you, and always returns the correct point/page in pdf coordinates, even when it's zoomed/offset.
Just use:
final int x = (int)e.getX();
final int y = (int)e.getY();
final GLLayout.PDFPos pos = m_layout.vGetPos(x, y);
and then retreive the vaules with pos.x, pos.y and pos.pageno

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

Last edit: by luca.f.

OnPDFDoubleTapped parameter 1 week 1 day ago #14527

  • tommaso
  • tommaso's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0
Ok I've managed my own function to retrieve pdfposition.
Thanks
public GLLayout.PDFPos MyGetPos(float posX, float posY) {
        //Trasformo Coordinate view in Coordinate Pdf.
        final int x = (int)posX;
        final int y = (int)posY;
        final GLLayout.PDFPos pos = m_layout.vGetPos(x, y);
        return pos;
    }

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

  • Page:
  • 1
Powered by Kunena Forum