Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The links are stored in the Annots array in the page dictionary. When you loop through the Annots array, you locate the link annotations by verifying the Subtype key in the annotation dictionary, it must be "Link" (name object). If you have a link annotation, you verify if it has an action stored in the A entry. If it has an action, you verify if it is a web link, the S entry in the action dictionary must have the value "URI" (name object). If you have an URI action, then you retrieve the link from the URI entry in the action dictionary.</p> <p>The annotation position on the PDF page is stored in the Rect array. These are 4 values for 2 opposite corners, usually lower left x, lower left y, upper right x, upper right y. These values are relative to bottom left corner of page's media box. These values must be transformed in view coordinates based on these variables: 1. position in the view where the page is displayed; 2. size in the view of the displayed page (current scaling factor * PDF page size); 3. page crop box; 4. page rotation.</p> <p>The conversion method looks like this:</p> <pre><code>- (CGPoint)convertPDFPointToViewPoint:(CGPoint)pdfPoint { CGPoint viewPoint = CGPointMake(0, 0); CGRect cropBox = CGPDFPageGetBoxRect(pdfPage, kCGPDFCropBox); int rotation = CGPDFPageGetRotationAngle(pdfPage); switch (rotation) { case 90: case -270: viewPoint.x = pageRenderRect.size.width * (pdfPoint.y - cropBox.origin.y) / cropBox.size.height; viewPoint.y = pageRenderRect.size.height * (pdfPoint.x - cropBox.origin.x) / cropBox.size.width; break; case 180: case -180: viewPoint.x = pageRenderRect.size.width * (cropBox.size.width - (pdfPoint.x - cropBox.origin.x)) / cropBox.size.width; viewPoint.y = pageRenderRect.size.height * (pdfPoint.y - cropBox.origin.y) / cropBox.size.height; break; case -90: case 270: viewPoint.x = pageRenderRect.size.width * (cropBox.size.height - (pdfPoint.y - cropBox.origin.y)) / cropBox.size.height; viewPoint.y = pageRenderRect.size.height * (cropBox.size.width - (pdfPoint.x - cropBox.origin.x)) / cropBox.size.width; break; case 0: default: viewPoint.x = pageRenderRect.size.width * (pdfPoint.x - cropBox.origin.x) / cropBox.size.width; viewPoint.y = pageRenderRect.size.height * (cropBox.size.height - pdfPoint.y) / cropBox.size.height; break; } viewPoint.x = viewPoint.x + pageRenderRect.origin.x; viewPoint.y = viewPoint.y + pageRenderRect.origin.y; return viewPoint; } </code></pre> <p>where the pageRenderRect is the rectangle in the view where the page is displayed. You can find additional reference source code here: <a href="http://ipdfdev.com/2011/06/21/links-navigation-in-a-pdf-document-on-iphone-and-ipad/" rel="nofollow">http://ipdfdev.com/2011/06/21/links-navigation-in-a-pdf-document-on-iphone-and-ipad/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload