Q:
I am trying to use the destination object to set the page that the
document will open to but it is not clear to me how and I could not
find a sample. Could you please give me a jump start?
------------
A:
// To create a 'goto' link annotation ... in C#
PageIterator itr = doc.PageFind(3); // Link to page #3 in the same PDF
document
if (itr != doc.PageEnd()) {
Page dest_page = itr.Current();
Action goto_page_3 =
Action.CreateGoto(Destination.CreateFitH(dest_page, 0));
Annot link = Annot.CreateLink(doc.GetSDFDoc(), new Rect(85, 458,
503, 502), goto_page_3);
src_page.AnnotPushBack(link);
}
// To create a 'goto' link annotation ... in C++
PageIterator itr = doc.PageFind(3); // Link to page #3 in the same PDF
document
if (itr != doc.PageEnd()) {
Page dest_page = *itr;
Action goto_page_3 =
Action::CreateGoto(Destination::CreateFitH(dest_page, 0));
Annot link = Annot::CreateLink(doc, Rect(85, 458, 503, 502),
goto_page_3);
src_page.AnnotPushBack(link);
}
For more examples, please see Annotation sample project: