GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API.

Export Word to ImageSource in WPF

Following example shows how to convert document page to ImageSource instance and attach it to WPF's Image control.

Screenshot
Export to ImageSource / Image Control Screenshot

See the full code below.

<Window x:Class="ConvertToImageSourceCs.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Export to ImageSource Sample" 
        SizeToContent="WidthAndHeight">

    <Border Margin="10" BorderBrush="Black" BorderThickness="1">
        <Image x:Name="ImageControl"/>
    </Border>

</Window>
using System.Windows;
using System.Windows.Controls;
using GemBox.Document;

namespace ConvertToImageSourceCs
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            SetImageSource(this.ImageControl);
        }

        private static void SetImageSource(Image image)
        {
            ComponentInfo.SetLicense("FREE-LIMITED-KEY");

            DocumentModel document = new DocumentModel();

            var section = new GemBox.Document.Section(document);
            document.Sections.Add(section);

            var paragraph = new GemBox.Document.Paragraph(document);
            section.Blocks.Add(paragraph);

            var run = new GemBox.Document.Run(document, "Hello World!");
            paragraph.Inlines.Add(run);

            image.Source = document.ConvertToImageSource(SaveOptions.ImageDefault);
        }
    }
}
Imports System.Windows
Imports System.Windows.Controls
Imports GemBox.Document

Class MainWindow

    Public Sub New()
        InitializeComponent()

        SetDocumentViewer(Me.ImageControl)
    End Sub

    Private Shared Sub SetDocumentViewer(image As Image)

        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim document = New DocumentModel()

        Dim section = New GemBox.Document.Section(document)
        document.Sections.Add(section)

        Dim paragraph = New GemBox.Document.Paragraph(document)
        section.Blocks.Add(paragraph)

        Dim run = New GemBox.Document.Run(document, "Hello World!")
        paragraph.Inlines.Add(run)

        image.Source = document.ConvertToImageSource(SaveOptions.ImageDefault)

    End Sub

End Class

Check next sample.