Annotation GetRect is flipping coordinates from those provided in SetRect

Q:

We are facing a serious issue while drawing a line annotation,while i am printing the co-ordinates its giving wrong y1 and y2 values(exchange values between y1 and y2).I have also provided that console logs below.

PDFPoint *myPoint;
PDFPoint *myPointEnded;
-(void)moveAroundAndDraw:(UIPanGestureRecognizer *)gestureRecognizer {
if ([gestureRecognizer state]==UIGestureRecognizerStateBegan) {
myPoint=[pdfViewCtrl ConvScreenPtToPagePt:point page_num:1];
}
else if ([gestureRecognizer state]==UIGestureRecognizerStateEnded) {
pdfPointEnded=[gestureRecognizer locationInView:pdfViewCtrl];
point=[[PDFPoint alloc] initWithPx:pdfPointEnded.x py:pdfPointEnded.y];
PointEnded=[pdfViewCtrl ConvScreenPtToPagePt:point page_num:1];
[myPointEnded retain];
NSLog(@“hi hi hi touch ended %f %f”,[myPointEnded getX],[myPointEnded getY]);
NSLog(@“hi hi hi touch began %f %f”,[myPoint getX],[myPoint getY]);

SDFDoc *sdfDoc= docToOpen.GetSDFDoc;
Page *page=[docToOpen GetPage:1];
ElementWriter *ew = [[ElementWriter alloc] init];
[ew WriterBeginWithPage: page placement: e_overlay page_coord_sys:YES compress: YES]; // begin writing to the
[docToOpen PagePushBack: page];

PDFRect *rect=[[PDFRect alloc]initWithX1:[myPoint getX] y1:[myPoint getY] x2:[myPointEnded getX] y2:[myPointEnded getY]];
LineAnnot *line=[LineAnnot Create: sdfDoc pos:rect];

}

//for verifying coordinate…
itr=[docToOpen GetPage:0];
int num_annots = [itr GetNumAnnots];
int i = 0;
for (i=0; i<num_annots; ++i)
{
Annot* annot = [itr GetAnnot: i];
if (![annot IsValid])
continue;
PDFRect* bbox;
if ([[[[[annot GetSDFObj] Get: @“Subtype”] Value] GetName] isEqualToString: @“Line”])
{
bbox = [annot GetRect];
}
NSLog(@" Position: %f, %f, %f, %f", [bbox GetX1], [bbox GetY1], [bbox GetX2], [bbox GetY2]);

//we printed coordinates in console for verification… for your reference.

–hi hi hi touch ended 2660.382161 1099.432198
–hi hi hi touch began 180.200907 2143.487185
– Position: 180.200907, 1099.432198, 2660.382161, 2143.487185

A:

The bounding box has been normalized, but this should not change the start/end points of the line. You can get the start/end points using GetStartPoint, GetEndPoint.