---
title: "Draw On PDF With Spot Color"
canonical: https://www.graphicsmill.com/samples/Codecs/SpotColors/DrawOnPdfWithSpotColor_cs
product: "Graphics Mill"
source: "Codecs/SpotColors/DrawOnPdfWithSpotColor.cs"
---

# Draw On PDF With Spot Color

Fills a rectangle with a PANTONE color.

## Instruction

Write a C# program that fills a rectangle with a PANTONE color in a PDF document.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
using Aurigma.GraphicsMill.Drawing;
```

## Code Snippet

```csharp
using (var pdfWriter = new PdfWriter("VectorSpot.pdf"))
using (var gr = pdfWriter.GetGraphics())
{
    var ink = new Ink("PANTONE Red 032 C", new RgbColor(243, 40, 55));
    var spotColor = new SpotColor(ink, 255);

    pdfWriter.AddPage(500, 500, 72, 72);

    gr.FillRectangle(new SolidBrush(spotColor), 10, 10, 400, 400);

    pdfWriter.Close();
}
```

## Explanation

Below is a C# code sample that demonstrates how to fill a rectangle with a PANTONE color in a PDF document using `PdfWriter`:

This code creates a PDF file where a rectangle is filled with a specified PANTONE color (in this case, PANTONE Red 032 C).

## Tags

- [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
- [Write](<https://www.graphicsmill.com/samples/tags/write_md>): Writing images with codecs

## Output

- [VectorSpot.pdf](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/VectorSpot_pdf>) (download)
- [VectorSpot.png](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/VectorSpot_png>) (preview)

## Used APIs

- [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.Codecs.PdfWriter.AddPage(Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_PdfWriter_AddPage_4_37f6c741.htm.md>)
- [Aurigma.GraphicsMill.Codecs.PdfWriter.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_PdfWriter_GetGraphics.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.SolidBrush](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md>)
- [Aurigma.GraphicsMill.Ink](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Ink.htm.md>)
- [Aurigma.GraphicsMill.SpotColor](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_SpotColor.htm.md>)
