---
title: "Save Spot Image To PDF"
canonical: https://www.graphicsmill.com/samples/Codecs/SpotColors/SaveSpotImageToPdf_cs
product: "Graphics Mill"
source: "Codecs/SpotColors/SaveSpotImageToPdf.cs"
---

# Save Spot Image To PDF

Saves an image with a spot color to PDF.

## Instruction

Write a C# program that creates an image with a spot color and saves it to a PDF file.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
using Aurigma.GraphicsMill.Drawing;
```

## Code Snippet

```csharp
using (var spotImage = new Bitmap(300, 300, PixelFormat.Format8bppSpot, RgbColor.White))
{
    spotImage.Ink = new Ink("PANTONE Red 032 C", new RgbColor(243, 40, 55));

    using (var gr = spotImage.GetGraphics())
    {
        var brush = new RadialGradientBrush();
        brush.ColorStops = new ColorStop[]
        {
            new ColorStop() { Color = RgbColor.White, Position = 0.0f },
            new ColorStop() { Color = RgbColor.Black, Position = 1.0f },
        };
        brush.StartPoint = new System.Drawing.PointF(gr.Width / 2, gr.Height / 2);
        brush.EndPoint = brush.StartPoint;

        brush.StartRadius = 0;
        brush.EndRadius = 300;

        gr.FillRectangle(brush, 0, 0, gr.Width, gr.Height);
    }

    using (var pdfWriter = new PdfWriter("SpotImage.pdf"))
    {
        Pipeline.Run(spotImage + pdfWriter);

        pdfWriter.Close();
    }
}
```

## Explanation

Below is a C# code sample that demonstrates how to create an image with a spot color (PANTONE Red 032 C) and save it to a PDF file.
The code uses `Bitmap` to create an image, applies a radial gradient brush, and writes the resulting image to a PDF using `PdfWriter`:

This code generates a spot color image with a radial gradient and saves it into a PDF file.

## Tags

- [Drawing](<https://www.graphicsmill.com/samples/tags/drawing_md>): Drawing vector shapes and text
- [PDF](<https://www.graphicsmill.com/samples/tags/pdf_md>): Importing and exporting PDF documents
- [Spot Color](<https://www.graphicsmill.com/samples/tags/spot_md>): Using spot colors in images

## Output

- [SpotImage.pdf](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/SpotImage_pdf>) (download)
- [SpotImage.png](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/SpotImage_png>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Bitmap_GetGraphics.htm.md>)
- [Aurigma.GraphicsMill.Bitmap.Ink](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_Ink.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageWriter.Close](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_ImageWriter_Close.htm.md>)
- [Aurigma.GraphicsMill.Codecs.PdfWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_PdfWriter.htm.md>)
- [Aurigma.GraphicsMill.Drawing.ColorStop](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_ColorStop.htm.md>)
- [Aurigma.GraphicsMill.Drawing.ColorStop.Color](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_ColorStop_Color.htm.md>)
- [Aurigma.GraphicsMill.Drawing.ColorStop.Position](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_ColorStop_Position.htm.md>)
- [Aurigma.GraphicsMill.Drawing.GradientBrush.ColorStops](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_GradientBrush_ColorStops.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.FillRectangle(Brush,Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_FillRectangle_5_2d30ad96.htm.md>)
- [Aurigma.GraphicsMill.Drawing.RadialGradientBrush](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_RadialGradientBrush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.RadialGradientBrush.EndPoint](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_RadialGradientBrush_EndPoint.htm.md>)
- [Aurigma.GraphicsMill.Drawing.RadialGradientBrush.EndRadius](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_RadialGradientBrush_EndRadius.htm.md>)
- [Aurigma.GraphicsMill.Drawing.RadialGradientBrush.StartPoint](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_RadialGradientBrush_StartPoint.htm.md>)
- [Aurigma.GraphicsMill.Drawing.RadialGradientBrush.StartRadius](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_RadialGradientBrush_StartRadius.htm.md>)
- [Aurigma.GraphicsMill.Ink](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Ink.htm.md>)
