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.

Pictures

GemBox.Document supports pictures of various formats like JPEG, GIF, PNG, TIFF, EMF and WMF.

Following example shows how to create pictures with sizes expressed in different units (pixels and inches) and with various positioning options.

Screenshot
Pictures Screenshot

See the full code below, use Run Example to execute.

using System;
using System.IO;
using System.Linq;
using GemBox.Document;
using GemBox.Document.Drawing;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        DocumentModel document = new DocumentModel();

        string pathToResources = "Resources";

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

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

        Picture picture1 = new Picture(document, Path.Combine(pathToResources, "Zahnrad.gif"), 61, 53, LengthUnit.Pixel);
        paragraph.Inlines.Add(picture1);

        paragraph.Inlines.Add(new Run(document, "GemBox.Document is a .NET component that enables developers to read, write, convert and print document files (DOCX, DOC, PDF, HTML, XPS, RTF and TXT) from .NET applications in a simple and efficient way."));

        Picture picture2 = new Picture(document, Path.Combine(pathToResources, "Dices.png"));
        picture2.Layout = new FloatingLayout(
            new HorizontalPosition(HorizontalPositionType.Left, HorizontalPositionAnchor.Page), 
            new VerticalPosition(2, LengthUnit.Inch, VerticalPositionAnchor.Page), 
            picture2.Layout.Size) { WrappingStyle = TextWrappingStyle.InFrontOfText };
        paragraph.Inlines.Add(picture2);

        Picture picture3 = new Picture(document, Path.Combine(pathToResources, "Graphics1.wmf"), 378, 189, LengthUnit.Pixel);
        picture3.Layout = new FloatingLayout(
            new HorizontalPosition(3.5, LengthUnit.Inch, HorizontalPositionAnchor.Page),
            new VerticalPosition(2, LengthUnit.Inch, VerticalPositionAnchor.Page),
            picture3.Layout.Size) { WrappingStyle = TextWrappingStyle.BehindText };
        paragraph.Inlines.Add(picture3);

        document.Save("Pictures.docx");
    }
}
Imports System
Imports System.IO
Imports System.Linq
Imports GemBox.Document
Imports GemBox.Document.Drawing

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim document As DocumentModel = New DocumentModel

        Dim pathToResources As String = "Resources"

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

        Dim paragraph As New Paragraph(document)
        section.Blocks.Add(paragraph)

        Dim picture1 As New Picture(document, Path.Combine(pathToResources, "Zahnrad.gif"), 61, 53, LengthUnit.Pixel)
        paragraph.Inlines.Add(picture1)

        paragraph.Inlines.Add(New Run(document, "GemBox.Document is a .NET component that enables developers to read, write, convert and print document files (DOCX, DOC, PDF, HTML, XPS, RTF and TXT) from .NET applications in a simple and efficient way."))

        Dim picture2 As New Picture(document, Path.Combine(pathToResources, "Dices.png"))
        picture2.Layout = New FloatingLayout(
                New HorizontalPosition(HorizontalPositionType.Left, HorizontalPositionAnchor.Page),
                New VerticalPosition(2, LengthUnit.Inch, VerticalPositionAnchor.Page),
                picture2.Layout.Size) With {.WrappingStyle = TextWrappingStyle.InFrontOfText}
        paragraph.Inlines.Add(picture2)

        Dim picture3 As New Picture(document, Path.Combine(pathToResources, "Graphics1.wmf"), 378, 189, LengthUnit.Pixel)
        picture3.Layout = New FloatingLayout(
            New HorizontalPosition(3.5, LengthUnit.Inch, HorizontalPositionAnchor.Page),
            New VerticalPosition(2, LengthUnit.Inch, VerticalPositionAnchor.Page),
            picture3.Layout.Size) With {.WrappingStyle = TextWrappingStyle.BehindText}
        paragraph.Inlines.Add(picture3)

        document.Save("Pictures.docx")

    End Sub

End Module

Check next sample.