# ServerSheetControl.GetFontFileAsync Method

> ServerSheetControl.GetFontFileAsync method in the TX Sheet Control .NET API: Reads a catalogued face for HTTP hosting, using the same bytes as PDF export.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Server.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > ServerSheetControl > ServerSheetControl.GetFontFileAsync Method
- **823 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/getfontfileasync-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/getfontfileasync-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/getfontfileasync-method/llms-full.txt

---

Reads a catalogued face for HTTP hosting, using the same bytes as PDF export.

### Syntax

```csharp
public Task<byte[]> GetFontFileAsync(string fileName, string hash, CancellationToken cancellationToken = default)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `fileName` | `string` | No | Unescaped filename from the catalog face URL. |
| `hash` | `string` | No | SHA-256 content version from the URL. Stale versions are rejected. |
| `cancellationToken` | `CancellationToken` | Yes | Cancels the pending operation. |

### Return Value

`Task<byte[]>`. Owned font bytes. Server filesystem paths remain private.

### Examples

Create and format a complete invoice before using this processing API. Return document bytes, operation metadata or notifications to the application; dispose owned controls after processing.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> CreateInvoiceGetFontFileAsyncAsync(ServerSheetControl control)
{
    var catalog = await control.GetFontCatalogAsync();
    var face = catalog.Families.First().Faces.First();
    var url = new Uri("https://fonts.example/" + face.Url);
    var fileName = Uri.UnescapeDataString(Path.GetFileName(url.AbsolutePath));
    var hash = url.Query.TrimStart('?').Split('&').Select(pair => pair.Split('=', 2)).Single(pair => pair[0] == "v")[1];
    return await control.GetFontFileAsync(fileName, hash);
}
```

### Remarks

Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.

### See Also

- [ServerSheetControl Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/llms-full.txt)
- [Font Handling](https://docs.textcontrol.com/tx-sheet-control/deployment/fonts/llms-full.txt)

---

## Nearby

- **Previous:** [ServerSheetControl.GetFontCatalogAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/getfontcatalogasync-method/llms-full.txt)
- **Next:** [ServerSheetControl.GetPrintLayoutAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/getprintlayoutasync-method/llms-full.txt)
