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

TOPIC:

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

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
can you please better explain the first part of the post?!
GetType() and GetFieldType() return an int so you can use the "==" operator to compare the results.

annotRect are coverted in pdf coordinates, if you want the X and Y, you should use :
annotRect[0] --> X
annotRect[1] --> Y

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

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

  • mfranc28
  • mfranc28's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 25
  • Thank you received: 0
My code:

public void OnPDFAnnotTapped(VPage p0, Annotation p1)
{

if (p1 != null && p1.GetType() == 20 && p1.GetFieldType() == 4)
{

float[] annotRect = p1.GetRect();
float tmp = annotRect[1];
annotRect[0] = p0.GetVX(annotRect[0]) - rPdfLayoutView.PDFGetX();
annotRect[1] = p0.GetVY(annotRect[3]) - rPdfLayoutView.PDFGetY();
annotRect[2] = p0.GetVX(annotRect[2]) - rPdfLayoutView.PDFGetX();
annotRect[3] = p0.GetVY(tmp) - rPdfLayoutView.PDFGetY();
}
}

Red Ones: Visual Studio give me error: Operator '==' cannot be applied to operands of type 'Type' and 'int'
Blue ones: Visual Studio give me errore: 'Page.Annotation' does not contain a definition for 'GetTypeField' and no extension method 'GetFieldType' accepting a first argument of type 'Annotation' could be found

Instead I have to write this:

if (p1 != null && p1.Type == 20 && p1.FieldType == 4)

I missing something?

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

Last edit: by mfranc28.

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

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
if (p1 != null && p1.GetType() == 20 && p1.GetFieldType() == 4)
is correct if you are implementing in native java.

In case of Xamarin.Android, it becomes:
if (p1 != null && p1.Type == 20 && p1.FieldType == 4)
The following user(s) said Thank You: mfranc28

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

Powered by Kunena Forum