# Attachments.GetFromFile Method

> Returns an array of EmbeddedFile objects that represent all embedded files in the specified PDF document.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 33.0
- **Namespace:** `TXTextControl.DocumentServer.PDF`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXDocumentServer.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXDocumentServer.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl.DocumentServer.PDF > Attachments.GetFromFile Method
- **573 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-pdf/attachments/getfromfile-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-pdf/attachments/getfromfile-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-pdf/attachments/getfromfile-method/llms-full.txt

---

### Description

Returns an array of [EmbeddedFile](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-pdf/embeddedfile/llms-full.txt) objects that represent all embedded files in the specified PDF document.

### Syntax

```csharp
public static EmbeddedFile[] GetFromFile(string fileName);
```

```vbnet
Public Function GetFromFile(fileName As String) As EmbeddedFile()
```

### Parameters

| Parameter | Description |
|---|---|
| fileName | The complete file path of the PDF document. |

### Return Value

Returns an array of [EmbeddedFile](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-pdf/embeddedfile/llms-full.txt) objects.

### Examples

The following example retrieves from file from the attachments.

```csharp
TXTextControl.DocumentServer.PDF.EmbeddedFile[] results = TXTextControl.DocumentServer.PDF.Attachments.GetFromFile("document.docx");
foreach (TXTextControl.DocumentServer.PDF.EmbeddedFile embeddedFile in results)
{
    Console.WriteLine(embeddedFile);
}
```

```vbnet
Dim results As TXTextControl.DocumentServer.PDF.EmbeddedFile() = TXTextControl.DocumentServer.PDF.Attachments.GetFromFile("document.docx")
For Each embeddedFile As TXTextControl.DocumentServer.PDF.EmbeddedFile In results
    Console.WriteLine(embeddedFile)
Next
```

---

## Nearby

- **Previous:** [Attachments.GetFromData Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-pdf/attachments/getfromdata-method/llms-full.txt)
- **Next:** [TXTextControl.DocumentServer.PDF.Contents namespace](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-pdf-contents/llms-full.txt)
