---
title: "Write raster and vector graphics to EPS"
canonical: https://www.graphicsmill.com/samples/Codecs/Eps/WriteRasterAndVectorGraphicsToEps_cs
product: "Graphics Mill"
source: "Codecs/Eps/WriteRasterAndVectorGraphicsToEps.cs"
---

# Write raster and vector graphics to EPS

Saves raster and vector graphics to EPS format.

## Instruction

Create an EPS file and draw both a bitmap and vector graphics (a rectangle and text) onto it.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
using Aurigma.GraphicsMill.Drawing;
```

## Code Snippet

```csharp
using (var writer = new EpsWriter("WriteRasterAndVectorGraphicsToEPS.eps", 800, 650))
using (var graphics = writer.GetGraphics())
{
    // Draw bitmap
    using (var bitmap = new Bitmap("Chicago.jpg"))
    {
        graphics.DrawImage(bitmap, 100f, 100f);
    }

    // Draw rectangle
    graphics.DrawRectangle(new Pen(RgbColor.Gray, 4f), 50f, 50f, 700f, 550f);

    // Draw text
    var font = graphics.CreateFont("Arial", 56f);
    var text = new PlainText("Confidential", font, new SolidBrush(RgbColor.OrangeRed), 400f, 340f, TextAlignment.Center);

    graphics.DrawText(text);
}
```

## Explanation

Here is a C# program that creates an EPS file containing a bitmap image, a rectangle, and a styled text label:

This code uses `EpsWriter` to create `WriteRasterAndVectorGraphicsToEPS.eps`, draws a bitmap (`Chicago.jpg`), a gray rectangle, and the word "Confidential" in large orange-red text. It demonstrates combining raster and vector elements in a single EPS file.

## Tags

- [Drawing](<https://www.graphicsmill.com/samples/tags/drawing_md>): Drawing vector shapes and text
- [EPS](<https://www.graphicsmill.com/samples/tags/eps_md>): Importing and exporting EPS files
- [Filesystem](<https://www.graphicsmill.com/samples/tags/filesystem_md>): Loading and saving images from files
- [Text](<https://www.graphicsmill.com/samples/tags/text_md>): Rendering and formatting text

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [WriteRasterAndVectorGraphicsToEPS.eps](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/WriteRasterAndVectorGraphicsToEPS_eps>) (download)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.EpsWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_EpsWriter.htm.md>)
- [Aurigma.GraphicsMill.Codecs.EpsWriter.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_EpsWriter_GetGraphics.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.CreateFont(String,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_CreateFont_2_1dbfa9fa.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.DrawImage(Bitmap,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawImage_3_b9413d4f.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.DrawRectangle(Pen,Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawRectangle_5_b3708ac1.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.DrawText(Text)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawText_1_f576d03f.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Pen](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PlainText](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_PlainText.htm.md>)
- [Aurigma.GraphicsMill.Drawing.SolidBrush](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.TextAlignment](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_TextAlignment.htm.md>)
