New to Telerik Document Processing? Start a free 30-day trial

Streams a PDF document to an output Stream, letting you write pages sequentially without holding the full document in memory.

Definition

Namespace:Telerik.Documents.Fixed.FormatProviders.Pdf.Streaming

Assembly:Telerik.Windows.Documents.Fixed.dll

Syntax:

C#
public sealed class PdfStreamWriter : IDisposable

Inheritance: objectPdfStreamWriter

Implements: IDisposable

Constructors

Creates a PDF stream writer and optionally leaves the output stream open when disposed.

C#
public PdfStreamWriter(Stream stream, bool leaveStreamOpen)
Parameters:streamStream

The stream.

leaveStreamOpenbool

Boolean value indicating whether or not to close the stream after PdfStreamWriter instance is disposed.

Creates a PDF stream writer over the specified stream.

C#
public PdfStreamWriter(Stream stream)
Parameters:streamStream

The stream.

Properties

Settings that control how the PDF is produced during streaming (compression, image quality, metadata).

C#
public PdfStreamWriterSettings Settings { get; }

Methods

Finalizes an instance of the PdfStreamWriter class. This finalizer ensures that unmanaged resources are properly released if Dispose was not called explicitly.

C#
protected ~PdfStreamWriter()

Begins a new page with the specified media box, crop box, and rotation and returns a writer for its content.

C#
public PdfPageStreamWriter BeginPage(Rect mediaBox, Rect cropBox, Rotation rotation)
Parameters:mediaBoxRect

Defines the boundaries of the physical medium on which the page is intended to be displayed or printed.

cropBoxRect

Defines the boundaries of the visible region of the page. When the page is displayed or printed, its contents are to be clipped (cropped) to this rectangle.

rotationRotation

The rotation.

Returns:

PdfPageStreamWriter

The page stream.

Begins a new page with the specified size and rotation and returns a writer for its content.

C#
public PdfPageStreamWriter BeginPage(Size pageSize, Rotation rotation)
Parameters:pageSizeSize

Size of the page.

rotationRotation

The rotation.

Returns:

PdfPageStreamWriter

The page stream.

Begins a new page with the specified size and returns a writer for its content.

C#
public PdfPageStreamWriter BeginPage(Size pageSize)
Parameters:pageSizeSize

Size of the page.

Returns:

PdfPageStreamWriter

The page stream.

Finalizes the document, writes all pending objects, and disposes resources; closes the stream unless leaveStreamOpen is true.

C#
public void Dispose()
Exceptions: InvalidOperationException

Thrown when one or more PdfFileSource instances that were used with this writer have not been disposed before disposing the writer. Always dispose PdfFileSource instances before disposing PdfStreamWriter to avoid empty pages and unexpected results.

Implements: IDisposable.Dispose()

Writes a page from a PdfPageSource into the output stream and finalizes it.

C#
public void WritePage(PdfPageSource pageSource)
Parameters:pageSourcePdfPageSource

The page source.

Writes a RadFixedPage into the output stream and finalizes it.

C#
public void WritePage(RadFixedPage page)
Parameters:pageRadFixedPage

The page.