Tips for Bookmark Links to Landscape Pages
Example issue: This linked bookmark was set for Page 3 of a landscaped page:
oTK.AddInternalLinkBookmark("Topic Title", 3, 0, 600)
The resulting bookmark links to the wrong page.
PDF page coordinates and bookmark links
An 8.5 in. x 11 in. page is equal to 612 by 792 PDF units.
The 0x, 0y point of a PDF document is in the lower-left corner, with Y increasing upward and X increasing to the right.
- To place bookmark links at the top left corner of an 8.5 by 11 portrait page, use the coordinates 0, 792.
- To place bookmark links at the top left corner of an 11 by 8.5 landscape page, use the coordinates 0, 612.
Syntax for AddInternalLinkBookmark
For a link to the top-left of Page 3 on a portrait page:
oTK.AddInternalLinkBookmark("Topic Title", 3, 0, 792)
For a link to the top-left of Page 3 on a landscape page:
oTK.AddInternalLinkBookmark("Topic Title", 3, 0, 612)
Important exception for rotated pages
When a page is in landscape position as a result of rotation in a PDF document,
the rotated page keeps the same page coordinates it had before any rotation.
For example, if a portrait 8.5 by 11 inch PDF page is rotated 90 degrees clockwise to a landscape position, it still uses the 0x, 0y position it had before rotation. The 0x,0y position that was in the bottom left corner is now displayed in the top-left corner.
As a result, the coordinates that mark the bookmark link position will vary for rotated pages, depending on how many degrees the page was rotated.
In order to adjust the values for the coordinates (based on the rotation of the page),
bookmark links that appear at the top left of rotated landscape pages would use these values for coordinates:
- 90 degrees: 0x, 0y
- 270 degrees: 612x, 0y
Toolkit provides a GetInputPageRotation call which, combined with Toolkit's Bounding Box calls, can be used to predetermine a page's current orientation and then adjust accordingly.
For an example of using these calls, see: