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

Convert PDF coordinates to view layout coord

More
IP: 188.10.33.120 7 years 10 months ago #13769 by Davide
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
More
IP: 93.34.225.185 7 years 10 months ago - 7 years 10 months ago #13770 by mfranc28
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?
Last edit: 7 years 10 months ago by mfranc28.
More
IP: 188.10.33.120 7 years 10 months ago #13771 by nermeen
Code:
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:
Code:
if (p1 != null && p1.Type == 20 && p1.FieldType == 4)
Time to create page: 0.361 seconds
Powered by Kunena Forum