# C1.C1Pdf.C1PdfDocument.AddLink

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_C1Pdf_C1PdfDocument_AddLink_" data-uid="C1.C1Pdf.C1PdfDocument.AddLink*">AddLink Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_C1Pdf_C1PdfDocument_AddLink_" data-uid="C1.C1Pdf.C1PdfDocument.AddLink*"></a>
<h4 id="C1_C1Pdf_C1PdfDocument_AddLink_System_String_System_Drawing_RectangleF_" data-uid="C1.C1Pdf.C1PdfDocument.AddLink(System.String,System.Drawing.RectangleF)">AddLink(string, RectangleF)</h4>
<div class="markdown level1 summary"><p>Adds a hyperlink to the current page.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void AddLink(string url, RectangleF rc)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AddLink(url As String, rc As RectangleF)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">url</span></td>
      <td><p>Link destination (can be a Url, a file name, or a local link destination).</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectanglef">RectangleF</a></td>
      <td><span class="parametername">rc</span></td>
      <td><p>Area on the page that will behave as a link (expressed in points, from the top-left corner of the page).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_C1Pdf_C1PdfDocument_AddLink_" data-uid="C1.C1Pdf.C1PdfDocument.AddLink*"></a>
<h4 id="C1_C1Pdf_C1PdfDocument_AddLink_System_String_System_Int32_System_Drawing_RectangleF_" data-uid="C1.C1Pdf.C1PdfDocument.AddLink(System.String,System.Int32,System.Drawing.RectangleF)">AddLink(string, int, RectangleF)</h4>
<div class="markdown level1 summary"><p>Adds a hyperlink to the document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void AddLink(string url, int page, RectangleF rc)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AddLink(url As String, page As Integer, rc As RectangleF)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">url</span></td>
      <td><p>Link destination (can be a Url, a file name, or a local link destination).</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">page</span></td>
      <td><p>Index of the page that contains the hyperlink</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectanglef">RectangleF</a></td>
      <td><span class="parametername">rc</span></td>
      <td><p>Area on the page that will behave as a link (expressed in points, from the top-left corner of the page).</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_C1Pdf_C1PdfDocument_AddLink_System_String_System_Int32_System_Drawing_RectangleF__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Hyperlinks can be external (Urls and file names) or local (other locations within the same document).</p>
<p>Local links are useful when you want to implement some type of cross-referencing within the document, such 
as a table of contents or an index. Local links are identical to regular hyperlinks, except for two things:</p>
<p>1) The <code class="paramref">url</code> parameter must start with a "#", and </p>
<p>2) You must specify the target location for the link using the AddTarget method.</p>
<p>Note that the <b>AddLink</b> method does not add any visible content to the page, so you will 
usually need another command along with <b>AddLink</b> to specify some text or an image that the user 
can see, as the example below demonstrates.</p>
</div>
<h5 id="C1_C1Pdf_C1PdfDocument_AddLink_System_String_System_Int32_System_Drawing_RectangleF__examples">Examples</h5>
<p>The code below adds a string that says &quot;Visit GrapeCity&quot; and a link that takes the user to the ComponentOne home page:</p>
<pre><code class="lang-csharp">Rect rc = new Rect(50, 50, 100, 15);                            // RectangleF
Font font = new Font("Arial", 10, PdfFontStyle.Underline);      // FontStyle
_c1pdf.AddLink("http://www.grapecity.com", rc);
_c1pdf.DrawString("Visit GrapeCity", font, Color.Blue, rc);  // Brushes.Blue</code></pre>

</div>
