New to Telerik Document ProcessingStart a free 30-day trial

Overview

Updated on Sep 8, 2026

Use PdfStreamWriter to create or compose PDF files with high performance and minimal memory use.

What Is PdfStreamWriter

The PdfStreamWriter API exports PDF files with high performance and a minimized memory footprint.

The writer achieves memory efficiency by writing PDF content directly to a stream without creating or preserving the PDF document model in memory. Performance efficiency comes from reading PDF page content from existing PDF files without decoding or parsing the page content. The read content is then written unmodified directly into the new file stream. Although the existing PDF page content is not modified, you can position it differently in the new PDF file and combine it with other existing or newly generated PDF page content.

PdfStreamWriter supports these scenarios when you create pages in a new PDF file:

  • Merge pages from different PDF documents.
  • Split PDF document pages.
  • Add and position page content from existing PDF files.
  • Add and position page content from newly generated RadFixedPage instances.
  • Merge and position content from existing PDF pages and generated RadFixedPage instances onto a single page in the new PDF file stream.

You can review these SDK examples:

PdfStreamWriter Structure

There are several classes responsible for writing the different parts of a PDF file:

ClassDescription
PdfStreamWriterThe root class responsible for writing PDF file content to a Stream. The WritePage() methods write a PDF page directly into the stream; overloads accept PdfPageSource or RadFixedPage.
PdfStreamWriterSettingsProvides options for customizing the exported PDF file. Access it through the Settings property of PdfStreamWriter. Exposes DocumentInfo, ImageQuality, StreamCompression, ImageCompression, WriteAnnotations, and the MergedFieldNameResolving event.
PdfPageStreamWriterResponsible for writing PDF page content to the file stream. Created by calling BeginPage() on PdfStreamWriter. The WriteContent() methods write content to the current page; overloads accept PdfPageSource or RadFixedPage.
PdfFileSourceRepresents the content of an existing PDF file. Dispose it before you dispose PdfStreamWriter.
PdfPageSourceRepresents the page content of an existing PDF file. Get instances from the Pages property of PdfFileSource.

Wrap each PdfFileSource in a using statement or dispose it explicitly before you dispose PdfStreamWriter. This order prevents empty pages and other unexpected results.

PdfStreamWriter or PdfFormatProvider

RadPdfProcessing provides two options for import and export: PdfStreamWriter and the PdfFormatProvider class.

Use the PdfStreamWriter API when you want to compose a new PDF from existing PDF pages, generated RadFixedPage instances, or both. This approach delivers high performance and minimal memory use because it streams content directly to the output.

Use PdfFormatProvider when your scenario requires full document import, inspection, or modification of existing page content. When you work with PdfStreamWriter, existing PDF page content stays unmodified and you can only place new content below or above it.

See Also