officefileapi-devexpress-dot-pdf-dot-pdfdocumentprocessor-dot-createemptydocument-x28-system-dot-io-dot-stream-x29.md
Creates an empty PDF document with no pages and writes it to a stream.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public void CreateEmptyDocument(
Stream stream
)
Public Sub CreateEmptyDocument(
stream As 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
Note
When all operations with a created document 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 snippets (auto-collected from DevExpress Examples) contain references to the CreateEmptyDocument(Stream) method.
Note
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.
using (PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor()) {
documentProcessor.CreateEmptyDocument(resultStream);
for (int i = 0; i < dashboard.Items.Count; i++) {
using (PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor()) {
documentProcessor.CreateEmptyDocument(resultStream);
for (int i = 0; i < parameters.Length; i++) {
office-file-api-in-web-api-app/CS/Controllers/PdfController.cs#L18
using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
processor.CreateEmptyDocument(result);
foreach (var file in files) {
Using documentProcessor As New PdfDocumentProcessor()
documentProcessor.CreateEmptyDocument(resultStream)
For i As Integer = 0 To parameters.Length - 1
See Also