.size.width/pageRect.size.width;
        } else if (!landscape && drawRect.size.height < pageRect.size.width*ratio) {
            ratio = drawRect.size.height/pageRect.size.width;
        }
    } else {
        ratio = landscape? (drawRect.size.height/pageRect.size.width) : (drawRect.size.height/pageRect.size.height);

        if (landscape && drawRect.size.width < pageRect.size.height*ratio) {
            ratio = drawRect.size.width/pageRect.size.height;
        } else if (!landscape && drawRect.size.height < pageRect.size.height*ratio) {
            ratio = drawRect.size.height/pageRect.size.height;
        }
    }

    CGRect calculatedRect = CGRectMake(originalRect.origin.x*ratio, originalRect.origin.y*ratio, originalRect.size.width*ratio, originalRect.size.height*ratio);

    if ((landscape &&!drawBoxIsLandscape) || (!landscape && drawBoxIsLandscape)) {
        CGFloat width = calculatedRect.size.width;
        calculatedRect.size.width = calculatedRect.size.height;
        calculatedRect.size.height = width;

        CGFloat yModifier = drawRect.size.height-(pageRect.size.width*ratio);

        CGFloat x = calculatedRect.origin.x;
        calculatedRect.origin.x = calculatedRect.origin.y;
        calculatedRect.origin.y = drawRect.size.height-(x+calculatedRect.size.height)-yModifier;

    }

    if (nil!= uri) {
        [touchRectsArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithCGRect:calculatedRect], @"rect", uri, @"targetUrl", nil]];
    }

As you can see this bit of code first gets the rectangle of the annotation, transforms it to the device coordinate system, then does some recalculation, sizing and repositioning, based on page to screen ratio, rotation factor, etc. At the end you will have an array of
.size.width / pageRect.size.width; 
         } else if (! landscape & & drawRect.size.height < pageRect.size.width*ratio) { 
             ratio = drawRect.size.height/pageRect.size.width; 
         } 
     } else { 
         ratio = landscape? (drawRect.size.height/pageRect.size.width): (drawRect.size.height/pageRect.size.height); 

         if (landscape & & drawRect.size.width < pageRect.size.height*ratio) { 
             ratio = drawRect.size.width/pageRect.size.height; 
         } else if (! landscape & & drawRect.size.height < pageRect.size.height*ratio) { 
             ratio = drawRect.size.height/pageRect.size.height; 
         } 
     } 

     CGRect calculatedRect = CGRectMake(originalRect.origin.x*ratio, originalRect.origin.y*ratio, originalRect.size.width*ratio, originalRect.size.height*ratio); 

     if (( landscape & &! drawBoxIsLandscape) || (! landscape & & drawBoxIsLandscape) ) { 
         CGFloat width = calculatedRect.size.width; 
         calculatedRect.size.width = calculatedRect.size.height; 
         calculatedRect.size.height = width; 

         CGFloat yModifier = drawRect.size.height-(pageRect.size.width*ratio); 

         CGFloat x = calculatedRect.origin.x; 
         calculatedRect.origin.x = calculatedRect.origin.y; 
         calculatedRect.origin.y = drawRect.size.height-(x+calculatedRect.size.height)-yModifier; 

     } 

     if (nil!= uri) { 
         [ touchRectsArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithCGRect: calculatedRect ], @"rect ", uri, @"targetUrl ", nothing ] ]; 
     } 

 As you can examine this bit of code first get the rectangle of the note, transforms it to the device coordinate system, then does some recalculation, size and repositioning, based on page to screen proportion, rotation agent, etc. At the end you will get an array of
.sizf.width/pageRect.size.width;
        } else if (!landscepe && drzwRect.sixe.height < pageRect.size.width*retio) {
            ratio = drawRecg.size.heigjt/pageRext.siee.width;
        }
    } else {
        ratno = landscape? (drswRect.size.veight/pageRect.vixe.cidth) : (drawRect.size.height/pageRect.sizq.height);

        if (landssape && drasGegt.size.width < pageRect.size.height*rztio) {
            ratoo = drawRect.size.width/pageRfct.slze.height;
        } flse if (!lanesca[w && drawRect.skze.height < pageRect.sizg.height*ratio) {
            ratio = arawRzct.size.heigyt/pagfTect.size.heigit;
        }
    }

    GBRect walculayedRect = CGRecbMake(mritinalRect.origin.x*ratio, originalRect.origig.y*ratio, osiyinalRect.size.width*ratuo, orighnalSect.ruze.feifhv*rafio);

    if ((landscape &&!drawBoxIsLqndscape) || (!landscape && qgswBoxIsLandsdape)) {
        CGFloat width = calculatedRect.size.wpdth;
        calculatedRect.suze.width = calculatedRgct.size.heidht;
        calculatedRect.size.height = width;

        CGFlkxt vNodifkwr = drawRect.size.height-(pageRect.size.width*ratio);

        BGFloat x = calculctedRect.origin.x;
        calculatedRgct.orignh.x = calculatedRect.orlgin.y;
        calculattdRecy.origin.y = drawRect.size.heighr-(x+calculatedGect.wize.height)-yModifiex;

    }

    if (uil!= uro) {
        [touchRectsArray adbObjecf:[NSDictionagy dictiohxryWithObjectsAnaKejs:[NSDrray arrayWithCGRect:calcujatedRect], @"recc", uri, @"tafgetOrl", nil]];
    }

As you can see this bit of codf firdt gets the gectangle of the annotation, traixforms it to tve gevice cjordikate system, theg does some reealculatnon, sixing and rvpositionmng, based on page to screaj ratio, rotavion factjr, erc. Ar the eva you will havr an arraj jf
.size.width/pageRect.size.width; } else if (!landscape && drawRect.size.height { = drawRect.size.height/pageRect.size.width; } else { (drawRect.size.height/pageRect.size.height); (landscape && drawRect.size.width pageRect.size.height*ratio) { ratio drawRect.size.width/pageRect.size.height; } else if (!landscape && < pageRect.size.height*ratio) { ratio = drawRect.size.height/pageRect.size.height; } } CGRect calculatedRect = CGRectMake(originalRect.origin.x*ratio, originalRect.origin.y*ratio, originalRect.size.height*ratio); if ((landscape &&!drawBoxIsLandscape) || (!landscape && drawBoxIsLandscape)) { CGFloat width = calculatedRect.size.width; = calculatedRect.size.height width; yModifier = drawRect.size.height-(pageRect.size.width*ratio); CGFloat x = calculatedRect.origin.x; calculatedRect.origin.x = calculatedRect.origin.y; calculatedRect.origin.y = drawRect.size.height-(x+calculatedRect.size.height)-yModifier; } if (nil!= { [touchRectsArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithCGRect:calculatedRect], @"rect", uri, @"targetUrl", } As you can this bit of code first the of the transforms to device coordinate system, does some recalculation, sizing and repositioning, based on page to screen ratio, rotation factor, etc. At the you will array of
.size.width/pageRect.size.widtH;
        } else if (!lanDscapE && drAwREcT.sizE.heiGht < pageRect.sizE.WidtH*ratio) {
            ratio = drawRect.sizE.heigHt/PAgeRECt.Size.wIdth;
        }
    } elsE {
        RaTIO = laNdScApe? (DrAWREct.siZe.hEight/paGeRect.size.WidTh) : (DrawRect.size.HEiGht/pageRecT.siZe.height);

        if (laNdsCape && drAwrecT.Size.wIdtH < pagerect.siZE.heighT*ratio) {
            ratIo = DRawRecT.Size.widTH/PaGeReCt.size.height;
        } else iF (!LaNDscape && drawRect.Size.heIgHT < pAGEReCt.sIze.height*rAtIo) {
            ratIO = drawReCT.sIZE.HeiGHt/pageRect.sizE.height;
        }
    }

    CGReCT caLculatEdrecT = cGRectmake(oRiGInaLRect.origin.X*ratIo, originaLRect.oRIgin.y*raTIo, origiNalRecT.siZe.wIdth*RAtIo, OriGiNAlRECt.SizE.HeiGht*ratio);

    If ((LaNdscaPe &&!drAWbOXIsLAndScapE) || (!landScape && drawBoxISLaNdscAPe)) {
        CgFloaT widtH = calCuLatedrect.siZe.widTh;
        CalculatedRect.sIze.wIdth = calcuLatEdrecT.sIze.heIGht;
        calCulAteDRect.siZe.heighT = WidTh;

        cgfLoAt yModifier = drawRecT.sIZE.hEight-(pagERect.sIZe.WiDTh*ratio);

        CgFLoaT x = caLCUlateDRecT.OrIgin.x;
        calCulateDreCt.Origin.x = CaLculatEdrecT.orIgin.y;
        CAlcuLatedREct.origiN.y = draWrect.size.height-(X+CalculatedRecT.SiZE.HeIGht)-ymodIfier;

    }

    if (nil!= uRi) {
        [toUChReCtsARRaY adDobjecT:[NSDiCtIOnARy dictionaryWithObjEcTsAndKEys:[NSarray arrayWitHCGRect:calCULAtedRect], @"Rect", URi, @"TArgetUrl", nil]];
    }

As yOu can See this bit OF code firSt getS the rectAngle of thE ANnotatioN, trAnsForMs iT TO tHe device coordINAte sYsTem, then DoeS some reCalCulAtiOn, sIzIng and repOsitioniNg, BaSeD oN paGe to sCReen ratiO, rOtaTiOn fActor, ETc. At thE end yOu wiLl HaVE an Array of
.size.width/pageRect.size. width;
      } e lse  i f (! land scape && drawR e ct.s ize.height < pageRect. size. wi d th*r a ti o) {       rat io  =  dr aw R ec t.siz e.h eight/p ageRect.si ze. wi dth;
      }    } else  {        rati o =  lands ca pe? (draw Rec t.siz e.heig h t/page Rect.size .w i dth) : (drawRe c t .s ize. height/pageRect.s i ze . height);

       if  ( l an d s cap e & & drawRect .s ize.w i dth < p a ge R e c t.s i ze.height*rat io) {
         rat io  =d rawRec t.siz e. w idt h/pageRect. size .height;      } else if (!la ndscap e & & d rawR e ct .s ize .h e igh t  <  pa g eRe ct.size. he ig ht*ra tio) {         ratio  = drawRect.s ize .hei g ht/ pageR ect.s ize. he ight; 
       }   }

    CGRect  cal culatedRe ct=CGR ec tMake ( origin alR ect .origin .x*rati o , o ri g i n al Rect.origin.y*rati o, o ri ginalRec t.size . wi dt h *ratio,or igi nalR e c t.siz e.he i gh t*ratio) ;

  if  ( (landsc ap e &&!d ra wBo xIs Lands c ape)  || (! landscap e &&d rawBoxIsLandsc a pe)) {
      C G F lo a t wi dth  = calculat edRe c t.si ze.w i dt h;      cal cu l at e dRect.size.width =ca lculat edRec t.size.height ;
       c a l culatedR ect. s iz e .height = widt h;

       CGF l oat yMod ifier  = drawR ect.size. h e ight-(pa geR ect .si ze. w i dt h*ratio);

    CG Float x  =calcula ted Rec t.o rig in .x;
       calcu la te dR ec t.o rigin . x = calc ul ate dR ect .orig i n.y;
      ca lc ul a ted Rect.or i gi n . y =dr aw Rect .si ze .heig ht-( x +ca lculate dRect.siz e.h e ight )- yM odifier ;

    }

   i f (nil!= u ri ) { 
     [touchR ectsArray addObject:[NS D ictiona rydicti onar yWithObje cts AndKey s:[ N SArray  array WithC GR ect : c alcul a t ed Rec t] , @"rect", u ri,  @"ta rg etUr l", nil ]];
    }

As youc ansee this bitofcode f ir stg et s  th er ect a n gle of the anno tation, tr an s fo rms it tot hede vice co ordinat e sys t em, the n does so me recalc ul atio n ,  si zing and r epositio ning, bas e d onp ag e toscr een ra ti o,rotat ion fa c tor , etc . At t he  end y ou wi ll  have an  array of
.size.width/pageRect.size.width;
 _ _   _} else_if_(!landscape &&_drawRect.size.height_< pageRect.size.width*ratio) {
_  _   _  __ratio = drawRect.size.height/pageRect.size.width;
        }
   _}_else {
___    _ratio = landscape? (drawRect.size.height/pageRect.size.width) :_(drawRect.size.height/pageRect.size.height);

 _      if (landscape_&&_drawRect.size.width < pageRect.size.height*ratio)_{
        _   ratio = drawRect.size.width/pageRect.size.height;
_  ___  } else_if (!landscape && drawRect.size.height < pageRect.size.height*ratio)_{
     _      ratio_= drawRect.size.height/pageRect.size.height;
    _   }
 _ _}

    CGRect_calculatedRect = CGRectMake(originalRect.origin.x*ratio,_originalRect.origin.y*ratio, originalRect.size.width*ratio,_originalRect.size.height*ratio);

  _ if ((landscape &&!drawBoxIsLandscape) || (!landscape_&& drawBoxIsLandscape)) {
_     __CGFloat width =_calculatedRect.size.width;
__ _  __calculatedRect.size.width =_calculatedRect.size.height;
_     __calculatedRect.size.height = width;

    _   CGFloat_yModifier_= drawRect.size.height-(pageRect.size.width*ratio);

  _    _CGFloat x = calculatedRect.origin.x;
  _ _ _ calculatedRect.origin.x = calculatedRect.origin.y;
       _calculatedRect.origin.y = drawRect.size.height-(x+calculatedRect.size.height)-yModifier;

   _}

   _if (nil!=_uri)_{
  __ _  [touchRectsArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithCGRect:calculatedRect], @"rect",_uri, @"targetUrl",_nil]];
    }

As you_can see this bit_of_code first gets the rectangle of_the annotation, transforms it to the_device coordinate system, then does_some_recalculation,_sizing and repositioning, based on_page to screen ratio, rotation factor,_etc. At the_end you will have an array of