> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/annotation/link-annotation.md).

# Add link annotation to a document on Server/Desktop

Learn how to add hyperlinks or intra-document link annotations to a PDF document page with this full code sample. Enhance your PDF annotations now! The Apryse Server SDK streamlines secure document pr

To add a hyperlink or intra-document link annotation to a PDF Document page.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
PDFDoc doc = new PDFDoc(filename);
Page page = doc.GetPage(1);

// Create a hyperlink
Link hyperlink = Link.Create(doc, new Rect(85, 570, 503, 524), Action.CreateURI(doc, "http://www.apryse.com"));
hyperlink.RefreshAppearance();
page.AnnotPushBack(hyperlink);

// Create an intra-document link
Action goto_page_3 = Action.CreateGoto(Destination.CreateFitH(doc.GetPage(3), 0));
Link link = Link.Create(doc, new Rect(85, 458, 503, 502), goto_page_3);
link.RefreshAppearance();
page.AnnotPushBack(link);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
PDFDoc doc(filename);
Page page = doc.GetPage(1);

// Create a hyperlink
Annots::Link hyperlink = Annots::Link::Create(doc, Rect(85, 570, 503, 524), Action::CreateURI(doc, "http://www.apryse.com"));
hyperlink.RefreshAppearance();
page.AnnotPushBack(hyperlink);

// Create an intra-document link
Action goto_page_3 = Action::CreateGoto(Destination::CreateFitH(doc.GetPage(3), 0));
Annots::Link link = Annots::Link::Create(doc, Rect(85, 458, 503, 502), goto_page_3);
link.RefreshAppearance();
page.AnnotPushBack(link);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
doc := NewPDFDoc(filename)
page := doc.GetPage(1)

// Create a hyperlink
hyperlink := LinkCreate(doc.GetSDFDoc(), NewRect(85.0, 570.0, 503.0, 524.0), ActionCreateURI(doc.GetSDFDoc(), "http://www.apryse.com"))
hyperlink.RefreshAppearance()
page.AnnotPushBack(hyperlink)

// Create an intra-document link
gotoPage3 := ActionCreateGoto(DestinationCreateFitH(doc.GetPage(3), 0))
link := LinkCreate(doc.GetSDFDoc(), NewRect(85.0, 458.0, 503.0, 502.0), gotoPage3)
link.RefreshAppearance()
page.AnnotPushBack(link)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFDoc doc = new PDFDoc(filename);
Page page = doc.getPage(1);

// Create a hyperlink
Link hyperlink = Link.create(doc, new Rect(85, 570, 503, 524), Action.createURI(doc, "http://www.apryse.com"));
hyperlink.refreshAppearance();
page.annotPushBack(hyperlink);

// Create an intra-document link
Action goto_page_3 = Action.createGoto(Destination.createFitH(doc.getPage(3), 0));
Link link = com.pdftron.pdf.annots.Link.create(doc.getSDFDoc(), new Rect(85, 458, 503, 502), goto_page_3);
link.refreshAppearance();
page.annotPushBack(link);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
  const doc = await PDFNet.PDFDoc.createFromURL(filename);
  const firstPage = await doc.getPage(1);

  // Create a hyperlink
  const createURIAction = await PDFNet.Action.createURI(doc, 'http://www.apryse.com');
  const linkRect = new PDFNet.Rect(85, 570, 503, 524);
  const hyperlink = await PDFNet.LinkAnnot.create(doc, linkRect);
  await hyperlink.setAction(createURIAction);
  await hyperlink.refreshAppearance();
  await firstPage.annotPushBack(hyperlink);

  // Create an intra-document link
  const page3 = await doc.getPage(3);
  const gotoPage3 = await PDFNet.Action.createGoto(await PDFNet.Destination.createFitH(page3, 0));
  const link = await PDFNet.LinkAnnot.create(doc, (new PDFNet.Rect(85, 458, 503, 502)));
  await link.setAction(gotoPage3);
  await link.refreshAppearance();
  await firstPage.annotPushBack(link);
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val doc = PDFDoc(filename)
val page = doc.getPage(1)

// Create a hyperlink
val hyperlink = Link.create(doc, Rect(85.0, 570.0, 503.0, 524.0), Action.createURI(doc, "http://www.apryse.com"))
hyperlink.refreshAppearance()
page.annotPushBack(hyperlink)

// Create an intra-document link
val goto_page_3 = Action.createGoto(Destination.createFitH(doc.getPage(3), 0.0))
val link = Link.create(doc.sdfDoc, Rect(85.0, 458.0, 503.0, 502.0), goto_page_3)
link.refreshAppearance()
page.annotPushBack(link)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];
PTPage *page = [doc GetPage:1];

// Create a hyperlink
PTLink *hyperlink = [PTLink CreateWithAction: [doc GetSDFDoc] pos: [[PTPDFRect alloc] initWithX1: 85 y1: 570 x2: 503 y2: 524] action: [PTAction CreateURI: [doc GetSDFDoc] uri: @"http://www.apryse.com"]];
[hyperlink RefreshAppearance];
[page AnnotPushBack: hyperlink];

// Create an intra-document link
PTAction *goto_page_3 = [PTAction CreateGoto: [PTDestination CreateFitH: [doc GetPage:3] top: 0]];
PTLink *link = [PTLink CreateWithAction: [doc GetSDFDoc] pos: [[PTPDFRect alloc] initWithX1: 85 y1: 458 x2: 503 y2: 502] action: goto_page_3];
[link RefreshAppearance];
[page AnnotPushBack: link];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)
let page: PTPage = doc.getPage(1)

// Create a hyperlink
let hyperlink = PTLink.create(withAction: doc.getSDFDoc(), pos: PTPDFRect(x1: 85, y1: 570, x2: 503, y2: 524), action: PTAction.createURI(doc.getSDFDoc(), uri: "http://www.apryse.com"))
hyperlink.refreshAppearance()
page.annotPushBack(hyperlink)

// Create an intra-document link
let goto_page_3 = PTAction.createGoto(PTDestination.createFitH(doc.getPage(3), top: 0))
let link: PTLink = PTLink.create(withAction: doc.getSDFDoc(), pos: PTPDFRect(x1: 85, y1: 458, x2: 503, y2: 502), action: goto_page_3)
link.refreshAppearance()
page.annotPushBack(link)
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$doc = new PDFDoc($filename);
$page = $doc->GetPage(1);

// Create a hyperlink
$hyperlink = Link::Create($doc->GetSDFDoc(), new Rect(85.0, 570.0, 503.0, 524.0), Action::CreateURI($doc->GetSDFDoc(), "http://www.apryse.com"));
$hyperlink->RefreshAppearance();
$page->AnnotPushBack($hyperlink);

// Create an intra-document link
$goto_page_3 = Action::CreateGoto(Destination::CreateFitH($doc->GetPage(3), 0));
$link = Link::Create($doc->GetSDFDoc(), new Rect(85.0, 458.0, 503.0, 502.0), $goto_page_3);
$link->RefreshAppearance();
$page->AnnotPushBack($link);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
doc = PDFDoc(filename)
page = doc.GetPage(1)

# Create a hyperlink
hyperlink = Link.Create(doc.GetSDFDoc(), Rect(85, 570, 503, 524), Action.CreateURI(doc.GetSDFDoc(), "http://www.apryse.com"))
hyperlink.RefreshAppearance()
page.AnnotPushBack(hyperlink)

# Create an intra-document link
goto_page_3 = Action.CreateGoto(Destination.CreateFitH(doc.GetPage(3), 0))
link = Link.Create(doc.GetSDFDoc(), Rect(85, 458, 503, 502), goto_page_3)
link.RefreshAppearance()
page.AnnotPushBack(link)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
doc = PDFDoc.new(filename)
page = doc.GetPage(1)

# Create a hyperlink
hyperlink = Link.Create(doc.GetSDFDoc(), Rect.new(85, 570, 503, 524), Action.CreateURI(doc.GetSDFDoc(), "http://www.apryse.com"))
hyperlink.RefreshAppearance()
page.AnnotPushBack(hyperlink)

# Create an intra-document link
goto_page_3 = Action.CreateGoto(Destination.CreateFitH(doc.GetPage(3), 0))
link = Link.Create(doc.GetSDFDoc(), Rect.new(85, 458, 503, 502), goto_page_3)
link.RefreshAppearance()
page.AnnotPushBack(link)
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim doc As PDFDoc = New PDFDoc(filename)
Dim page As Page = doc.GetPage(1)

' Create a hyperlink
Dim hyperlink As Link = Link.Create(doc, New Rect(85, 570, 503, 524), Action.CreateURI(doc, "http://www.apryse.com"))
hyperlink.RefreshAppearance()
page.AnnotPushBack(hyperlink)

' Create an intra-document link
Dim goto_page_3 As Action = Action.CreateGoto(Destination.CreateFitH(doc.GetPage(3), 0))
Dim lnk As Link = Link.Create(doc, New Rect(85, 458, 503, 502), goto_page_3)
link.refreshAppearance()
page.AnnotPushBack(lnk)
```

{% endcode %}
{% endtab %}
{% endtabs %}

[Add or edit PDF annotations sample](/core/get-started/samples/annotationtest.md) Full code sample which shows how to add or edit PDF annotations (e.g. hyperlink, intra-document link, stamp, rubber stamp, file attachment, sound, text, free-text, line, circle, square, polygon, polyline, highlight, squiggly, caret, and ink). Code sample is available in C++, C#, Java, Python, Go, PHP, Ruby & VB.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/annotation/link-annotation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
