# C1.C1Pdf.C1PdfDocument.AddAttachment

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_C1Pdf_C1PdfDocument_AddAttachment_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment*">AddAttachment Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_C1Pdf_C1PdfDocument_AddAttachment_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment*"></a>
<h4 id="C1_C1Pdf_C1PdfDocument_AddAttachment_System_String_System_Drawing_RectangleF_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment(System.String,System.Drawing.RectangleF)">AddAttachment(string, RectangleF)</h4>
<div class="markdown level1 summary"><p>Adds a file attachment 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 AddAttachment(string file, RectangleF rc)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AddAttachment(file 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">file</span></td>
      <td><p>The file that will be included as an attachment.</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 of the page that will contain the attachment (in points measured from the top-left corner of the page).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_C1Pdf_C1PdfDocument_AddAttachment_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment*"></a>
<h4 id="C1_C1Pdf_C1PdfDocument_AddAttachment_System_String_System_Drawing_RectangleF_C1_C1Pdf_AttachmentIconEnum_System_Drawing_Color_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment(System.String,System.Drawing.RectangleF,C1.C1Pdf.AttachmentIconEnum,System.Drawing.Color)">AddAttachment(string, RectangleF, AttachmentIconEnum, Color)</h4>
<div class="markdown level1 summary"><p>Adds a file attachment 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 AddAttachment(string file, RectangleF rc, AttachmentIconEnum icon, Color iconColor)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AddAttachment(file As String, rc As RectangleF, icon As AttachmentIconEnum, iconColor As Color)</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">file</span></td>
      <td><p>The file that will be included as an attachment.</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 of the page that will contain the attachment (in points measured from the top-left corner of the page).</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.C1Pdf.AttachmentIconEnum.html">AttachmentIconEnum</a></td>
      <td><span class="parametername">icon</span></td>
      <td><p><a class="xref" href="C1.C1Pdf.AttachmentIconEnum.html">AttachmentIconEnum</a> value that determines the appearance of the attachment icon.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a></td>
      <td><span class="parametername">iconColor</span></td>
      <td><p><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a> of the attachment icon.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_C1Pdf_C1PdfDocument_AddAttachment_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment*"></a>
<h4 id="C1_C1Pdf_C1PdfDocument_AddAttachment_System_String_System_Drawing_RectangleF_System_Int32_C1_C1Pdf_AttachmentIconEnum_System_Drawing_Color_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment(System.String,System.Drawing.RectangleF,System.Int32,C1.C1Pdf.AttachmentIconEnum,System.Drawing.Color)">AddAttachment(string, RectangleF, int, AttachmentIconEnum, Color)</h4>
<div class="markdown level1 summary"><p>Adds a file attachment 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 AddAttachment(string file, RectangleF rc, int page, AttachmentIconEnum icon, Color iconColor)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AddAttachment(file As String, rc As RectangleF, page As Integer, icon As AttachmentIconEnum, iconColor As Color)</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">file</span></td>
      <td><p>The file that will be included as an attachment.</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 of the page that will contain the attachment (in points measured from the top-left corner of the page).</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 attachment.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.C1Pdf.AttachmentIconEnum.html">AttachmentIconEnum</a></td>
      <td><span class="parametername">icon</span></td>
      <td><p><a class="xref" href="C1.C1Pdf.AttachmentIconEnum.html">AttachmentIconEnum</a> value that determines the appearance of the attachment icon.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a></td>
      <td><span class="parametername">iconColor</span></td>
      <td><p>The color of the attachment icon.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_C1Pdf_C1PdfDocument_AddAttachment_System_String_System_Drawing_RectangleF_System_Int32_C1_C1Pdf_AttachmentIconEnum_System_Drawing_Color__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>When the user moves the mouse over an area of the page that contains an attachment,
the mouse pointer and tool tip change to indicate that the user can retrieve the attachment.
The user can right-click the attachment area to open or save the attachment.</p>
</div>


<a id="C1_C1Pdf_C1PdfDocument_AddAttachment_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment*"></a>
<h4 id="C1_C1Pdf_C1PdfDocument_AddAttachment_System_String_System_Byte___System_Drawing_RectangleF_C1_C1Pdf_AttachmentIconEnum_System_Drawing_Color_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment(System.String,System.Byte[],System.Drawing.RectangleF,C1.C1Pdf.AttachmentIconEnum,System.Drawing.Color)">AddAttachment(string, byte[], RectangleF, AttachmentIconEnum, Color)</h4>
<div class="markdown level1 summary"><p>Adds a stream-based attachment 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 AddAttachment(string attachmentName, byte[] attachmentData, RectangleF rc, AttachmentIconEnum icon, Color iconColor)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AddAttachment(attachmentName As String, attachmentData As Byte(), rc As RectangleF, icon As AttachmentIconEnum, iconColor As Color)</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">attachmentName</span></td>
      <td><p>Name to be shown next to the attachment.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</td>
      <td><span class="parametername">attachmentData</span></td>
      <td><p>Byte array containing the attachment data.</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 of the page that will contain the attachment (in points measured from the top-left corner of the page).</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.C1Pdf.AttachmentIconEnum.html">AttachmentIconEnum</a></td>
      <td><span class="parametername">icon</span></td>
      <td><p><a class="xref" href="C1.C1Pdf.AttachmentIconEnum.html">AttachmentIconEnum</a> value that determines the appearance of the attachment icon.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a></td>
      <td><span class="parametername">iconColor</span></td>
      <td><p>The color of the attachment icon.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_C1Pdf_C1PdfDocument_AddAttachment_System_String_System_Byte___System_Drawing_RectangleF_C1_C1Pdf_AttachmentIconEnum_System_Drawing_Color__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This override allows you to add attachments containing data that does not come from files.
For example, the data could come from blobs or streams stored in a database.</p>
</div>


<a id="C1_C1Pdf_C1PdfDocument_AddAttachment_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment*"></a>
<h4 id="C1_C1Pdf_C1PdfDocument_AddAttachment_System_String_System_Byte___System_Drawing_RectangleF_System_Int32_C1_C1Pdf_AttachmentIconEnum_System_Drawing_Color_" data-uid="C1.C1Pdf.C1PdfDocument.AddAttachment(System.String,System.Byte[],System.Drawing.RectangleF,System.Int32,C1.C1Pdf.AttachmentIconEnum,System.Drawing.Color)">AddAttachment(string, byte[], RectangleF, int, AttachmentIconEnum, Color)</h4>
<div class="markdown level1 summary"><p>Adds a stream-based attachment 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 AddAttachment(string attachmentName, byte[] attachmentData, RectangleF rc, int page, AttachmentIconEnum icon, Color iconColor)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub AddAttachment(attachmentName As String, attachmentData As Byte(), rc As RectangleF, page As Integer, icon As AttachmentIconEnum, iconColor As Color)</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">attachmentName</span></td>
      <td><p>Name to be shown next to the attachment.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</td>
      <td><span class="parametername">attachmentData</span></td>
      <td><p>Byte array containing the attachment data.</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 of the page that will contain the attachment (in points measured from the top-left corner of the page).</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 attachment.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.C1Pdf.AttachmentIconEnum.html">AttachmentIconEnum</a></td>
      <td><span class="parametername">icon</span></td>
      <td><p><a class="xref" href="C1.C1Pdf.AttachmentIconEnum.html">AttachmentIconEnum</a> value that determines the appearance of the attachment icon.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a></td>
      <td><span class="parametername">iconColor</span></td>
      <td><p>The color of the attachment icon.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_C1Pdf_C1PdfDocument_AddAttachment_System_String_System_Byte___System_Drawing_RectangleF_System_Int32_C1_C1Pdf_AttachmentIconEnum_System_Drawing_Color__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This override allows you to add attachments containing data that does not come from files.
For example, the data could come from blobs or streams stored in a database.</p>
</div>
</div>
