# Load an Office document for conversion from a stream in C#

### PDF

[PDF](https://www.nutrient.io/guides/dotnet/load-a-file/converter/from-stream-pdf.md)

### MS Office

[MS Office](https://www.nutrient.io/guides/dotnet/load-a-file/converter/from-stream-office.md)

### Image

[Image](https://www.nutrient.io/guides/dotnet/load-a-file/converter/from-stream-image.md)

### Bitmap

[Bitmap](https://www.nutrient.io/guides/dotnet/load-a-file/converter/from-stream-bitmap.md)

### SVG

[SVG](https://www.nutrient.io/guides/dotnet/load-a-file/converter/from-stream-svg.md)

### TIFF

[TIFF](https://www.nutrient.io/guides/dotnet/load-a-file/converter/from-stream-tiff.md)

### More...

[More...](https://www.nutrient.io/guides/dotnet/load-a-file/converter/from-stream-more.md)

To load an Office document for conversion from a stream, use the [`LoadFromStream` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureDocumentConverter~LoadFromStream.html) from the [`GdPictureDocumentConverter` class](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureDocumentConverter.html).

`LoadFromStream` accepts:

- `Stream` — The input stream containing the document data.

- `DocumentFormat` (optional) — A member of the [`DocumentFormat` enumeration](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.DocumentFormat.html).

For example, `DocumentFormat` can be:

- Word — `DocumentFormat.DocumentFormatDOCX`

- Excel — `DocumentFormat.DocumentFormatXLSX`

- PowerPoint — `DocumentFormat.DocumentFormatPPTX`

`LoadFromStream` returns a `GdPictureStatus`, which should always be checked before conversion.

To load and convert an Office document from a stream (example: Word to PDF), use the following code:

### C#

```csharp

using GdPicture14;
using System;
using System.IO;

// Create a stream object from a Word file.
using Stream streamFile = new FileStream(@"C:\temp\source.docx", FileMode.Open, FileAccess.Read);
using GdPictureDocumentConverter converter = new GdPictureDocumentConverter();

GdPictureStatus status = converter.LoadFromStream(streamFile, DocumentFormat.DocumentFormatDOCX);
if (status!= GdPictureStatus.OK)
{
    Console.WriteLine($"LoadFromStream failed: {status}");
    return;
}

status = converter.SaveAsPDF(@"C:\temp\output.pdf");
if (status!= GdPictureStatus.OK)
{
    Console.WriteLine($"SaveAsPDF failed: {status}");
}

```

### VB.NET

```vb

Imports GdPicture14
Imports System.IO

Using streamFile As Stream = New FileStream("C:\temp\source.docx", FileMode.Open, FileAccess.Read),
      converter As New GdPictureDocumentConverter()

    Dim status As GdPictureStatus = converter.LoadFromStream(streamFile, DocumentFormat.DocumentFormatDOCX)
    If status <> GdPictureStatus.OK Then
        Console.WriteLine($"LoadFromStream failed: {status}")
        Return
    End If

    status = converter.SaveAsPDF("C:\temp\output.pdf")
    If status <> GdPictureStatus.OK Then
        Console.WriteLine($"SaveAsPDF failed: {status}")
    End If
End Using

```
---

## Related pages

- [Load an image for conversion in C#](/guides/dotnet/load-a-file/converter/from-local-storage-image.md)
- [Load a TIFF for conversion in C#](/guides/dotnet/load-a-file/converter/from-local-storage-tiff.md)
- [Load a PDF for conversion in C#](/guides/dotnet/load-a-file/converter/from-local-storage-pdf.md)
- [Load any file for conversion in C#](/guides/dotnet/load-a-file/converter/from-local-storage-more.md)
- [Load a bitmap (BMP) for conversion in C#](/guides/dotnet/load-a-file/converter/from-local-storage-bitmap.md)
- [Load and convert a bitmap image from a remote URL in C#](/guides/dotnet/load-a-file/converter/from-remote-url-bitmap.md)
- [Load an Office document for conversion in C#](/guides/dotnet/load-a-file/converter/from-local-storage-office.md)
- [Load a vector image (SVG) for conversion in C#](/guides/dotnet/load-a-file/converter/from-local-storage-svg.md)
- [Load and convert an SVG image from a remote URL in C#](/guides/dotnet/load-a-file/converter/from-remote-url-svg.md)
- [Convert documents from remote URLs using C#](/guides/dotnet/load-a-file/converter/from-remote-url-office.md)
- [Load an image for conversion from a stream in C#](/guides/dotnet/load-a-file/converter/from-stream-image.md)
- [Load any file for conversion from a remote URL in C#](/guides/dotnet/load-a-file/converter/from-remote-url-more.md)
- [Load an image for conversion from a remote URL in C#](/guides/dotnet/load-a-file/converter/from-remote-url-image.md)
- [Load a TIFF for conversion from a remote URL in C#](/guides/dotnet/load-a-file/converter/from-remote-url-tiff.md)
- [Load a PDF for conversion from a remote URL in C#](/guides/dotnet/load-a-file/converter/from-remote-url-pdf.md)
- [Load a bitmap (BMP) for conversion from a stream in C#](/guides/dotnet/load-a-file/converter/from-stream-bitmap.md)
- [Load a PDF for conversion from a stream in C#](/guides/dotnet/load-a-file/converter/from-stream-pdf.md)
- [Load a vector image (SVG) for conversion from a stream in C#](/guides/dotnet/load-a-file/converter/from-stream-svg.md)
- [Load any file for conversion from a stream in C#](/guides/dotnet/load-a-file/converter/from-stream-more.md)
- [Load a TIFF for conversion from a stream in C#](/guides/dotnet/load-a-file/converter/from-stream-tiff.md)

