Skip to main content

PdfDocumentProcessor.CreateEmptyDocument(Stream) Method

Creates an empty PDF document with no pages and writes it to a stream.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v23.2.dll

NuGet Package: DevExpress.Document.Processor


public void CreateEmptyDocument(
    Stream stream


Name Type Description
stream Stream

A Stream class descendant specifying the stream to which the PDF empty document should be written.


Use this method to create an empty document and write it to a stream.

Use the PDF document creation API to continue to generate the document layout (e.g., append pages with graphics to the PDF document, generate bookmarks, and attach files). Refer to the following topic for more information: Additional Content


When all operations with a created completed are completed, you need to close the document. Call the PdfDocumentProcessor.CloseDocument method or dispose of the PdfDocumentProcessor instance.

The PDF specification does not describe empty documents. For this reason, most third-party PDF viewers cannot open such files. This does not apply to the DevExpress WinForms PDF Viewer and WPF PDF Viewer, which are less demanding concerning the validity of opened documents, and are capable of opening documents containing no pages.

This CreateEmptyDocument method overload writes generated document content into the stream specified as this method’s parameter. The SaveDocument method call rewrites this stream.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CreateEmptyDocument(Stream) method.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also