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

TOPIC:

Convert PDF coordinates to view layout coord 6 years 6 months ago #13019

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
I have checked your project and you are not activating the demo license correctly.
As written here : www.radaeepdf.com/support/knowledge-base?view=kb&kbartid=4
You have to change the applicationId in app.gradle to test the license in your own project :
applicationId "com.radaee.reader"
The following user(s) said Thank You: geertvm

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

Convert PDF coordinates to view layout coord 6 years 6 months ago #13021

  • geertvm
  • geertvm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Hi,
I see the signature annotations with the premium licence correctly enabled.
I have a strange behaviour with the same sample/same pdf.
I've enabled the callbacks
m_view.PDFOpen(m_doc, this);

And in the OnPDFAnnotTapped
the first time I click it's recognised, the second time the annotations is null, the third time it's again OK....


@Override
public void OnPDFAnnotTapped(VPage vpage, Page.Annotation annot) {

Log.d(TAG, "OnPDFAnnotTapped...");

if (annot != null) {
int type = annot.GetType();
int ft = annot.GetFieldType();

Log.d(TAG, "TYPE = " + type);
Log.d(TAG, "FIELD TYPE = " + ft);
}

if (annot != null && annot.GetType() == 20 && annot.GetFieldType() == 4) {
Log.d(TAG, "OnPDFAnnotTapped...SIGNATURE....");

float[] annotRect = annot.GetRect();
float tmp = annotRect[1];
annotRect[0] = vpage.GetVX(annotRect[0]) - m_view.PDFGetX();
annotRect[1] = vpage.GetVY(annotRect[3]) - m_view.PDFGetY();
annotRect[2] = vpage.GetVX(annotRect[2]) - m_view.PDFGetX();
annotRect[3] = vpage.GetVY(tmp) - m_view.PDFGetY();
}
}

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

Convert PDF coordinates to view layout coord 6 years 6 months ago #13026

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
this is the standard behavior of the library.
With the first tap you select the annot, with the second you unselect it.

If you want to change this behavior, you can modify onSingleTapConfirmed of PDFLayoutView and handle it as you want..
The following user(s) said Thank You: geertvm

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

Convert PDF coordinates to view layout coord 6 years 5 months ago #13062

  • geertvm
  • geertvm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Hi,

When clicking on a signature field, the document view scrolls after handling the click event
The document view should stay the same...

What we now basically do is:
1/ Select signature fields with the setOnTouchListener
We compare the coordinates with the know PDF coordinates.
We don't use the OnPDFAnnotTapped. The behaviour is not exactly what we want...

2/ Add some overlay on top of the view
@Override
public void onPDFPageDisplayed(Canvas canvas, VPage vpage) {
drawSignatureFields(canvas, vpage);
}

The test app can be downloaded from
www.dropbox.com/s/xrf6kagyrjlt44q/PdfViewSup.zip?dl=0

Regards,

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

Convert PDF coordinates to view layout coord 6 years 5 months ago #13065

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
I have checked your project, please modify the isHandled value in MainActivty at line 216 :
isHandled = false;

After that edit seems to work properly, please check it and let us know..

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

Convert PDF coordinates to view layout coord 5 years 11 months ago #13768

  • mfranc28
  • mfranc28's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 25
  • Thank you received: 0
Having issue with
if(annot != null && annot.GetType() == 20 && annot.GetFieldType() == 4) {

Operator '==' cannot be applied to operands of type 'Type' and 'Int'

Then, how can I convert this:
float[] annotRect = annot.GetRect();
float tmp = annotRect[1];
annotRect[0] = vpage.GetVX(annotRect[0]) - m_view.PDFGetX();
annotRect[1] = vpage.GetVY(annotRect[3]) - m_view.PDFGetY();
annotRect[2] = vpage.GetVX(annotRect[2]) - m_view.PDFGetX();
annotRect[3] = vpage.GetVY(tmp) - m_view.PDFGetY();

to X and Y screen coordinate?

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

Last edit: by mfranc28.
Powered by Kunena Forum