---
title: "Save Vector Content To JPEG"
canonical: https://www.graphicsmill.com/samples/Codecs/VectorFormats/SaveToJpeg_cs
product: "Graphics Mill"
source: "Codecs/VectorFormats/SaveToJpeg.cs"
---

# Save Vector Content To JPEG

Reads vector content from the specified PDF file, rasterizes it, and saves it in JPEG format.

## Instruction

Gets content from the specified PDF file and saves it in JPEG format.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
```

## Code Snippet

```csharp
using (var reader = new PdfReader("GraphicsContainer.pdf"))
using (var gc = reader.Frames[0].GetContent())
using (var writer = new JpegWriter("GraphicsContainer.jpg"))
using (var ig = new ImageGenerator(gc, PixelFormat.Format24bppRgb, RgbColor.White))
{
    Pipeline.Run(ig + writer);
}
```

## Explanation

The following code:

- Loads a PDF file and retrieves the graphics content from the first frame.
- Uses `ImageGenerator` to render the content into a bitmap with 24bpp RGB pixel format and a white background.
- Saves the result as a JPEG image using `JpegWriter`.

## Tags

- [Format Conversion](<https://www.graphicsmill.com/samples/tags/format-conversion_md>): Converting images between formats
- [JPG](<https://www.graphicsmill.com/samples/tags/jpg_md>): Reading and writing JPEG images
- [PDF](<https://www.graphicsmill.com/samples/tags/pdf_md>): Importing and exporting PDF documents
- [Rasterization](<https://www.graphicsmill.com/samples/tags/rasterization_md>): Rasterizing vector graphics to bitmaps

## Input

- [GraphicsContainer.pdf](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/GraphicsContainer_pdf>) (download)

## Output

- [GraphicsContainer.jpg](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/GraphicsContainer_jpg>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.JpegWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_JpegWriter.htm.md>)
- [Aurigma.GraphicsMill.Codecs.PdfFrame.GetContent](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_PdfFrame_GetContent.htm.md>)
- [Aurigma.GraphicsMill.Codecs.PdfReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_PdfReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.PdfReader.Frames](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_PdfReader_Frames.htm.md>)
- [Aurigma.GraphicsMill.ImageGenerator](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_ImageGenerator.htm.md>)
