---
title: "Write Bitmap To PDF Memory Friendly"
canonical: https://www.graphicsmill.com/samples/Codecs/Pdf/WriteBitmapToPdfMemoryFriendly_cs
product: "Graphics Mill"
source: "Codecs/Pdf/WriteBitmapToPdfMemoryFriendly.cs"
---

# Write Bitmap To PDF Memory Friendly

Saved bitmap to PDF format using memory-friendly Pipeline API.

## Instruction

Write a C# program that reads a JPEG image and saves it to a PDF format using a memory-friendly Pipeline API.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
```

## Code Snippet

```csharp
using (var reader = new JpegReader("Chicago.jpg"))
using (var writer = new PdfWriter("WritePdfMemoryFriendly.pdf"))
{
    Pipeline.Run(reader + writer);
}
```

## Explanation

Below is a C# code sample that demonstrates how to read a JPEG image and save it to a PDF using a memory-friendly approach with the Pipeline API:

This code reads an image from a JPEG file and writes it to a PDF document without loading the entire image into memory at once, making the operation more memory efficient.

## 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

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [WritePdfMemoryFriendly.pdf](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/WritePdfMemoryFriendly_pdf>) (download)
- [WritePdfMemoryFriendly.png](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/WritePdfMemoryFriendly_png>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.JpegReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_JpegReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.PdfWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_PdfWriter.htm.md>)
