officefileapi-devexpress-dot-xtrarichedit-dot-richeditdocumentserver-dot-exporttopdf-x28-system-dot-io-dot-stream-devexpress-dot-xtraprinting-dot-pdfexportoptions-x29.md
Exports the document to the specified stream in PDF format.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
public virtual void ExportToPdf(
Stream stream,
PdfExportOptions pdfExportOptions
)
Public Overridable Sub ExportToPdf(
stream As Stream,
pdfExportOptions As PdfExportOptions
)
| Name | Type | Description |
|---|---|---|
| stream | Stream |
A Stream object, to which the document is exported.
| | pdfExportOptions | PdfExportOptions |
A PdfExportOptions instance containing properties which define how a document is exported to PDF format.
|
PDF Export features and limitations are outlined in the following document: Export to PDF
using DevExpress.XtraRichEdit;
using DevExpress.XtraPrinting;
using System.IO;
//...
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
// Load a DOCX document.
wordProcessor.LoadDocument("Documents\\MovieRentals.docx");
// Specify export options.
PdfExportOptions options = new PdfExportOptions();
options.DocumentOptions.Author = "Mark Jones";
options.Compressed = false;
options.ImageQuality = PdfJpegImageQuality.Highest;
// Export the document to a stream.
using (FileStream pdfFileStream = new FileStream("Document_PDF.pdf", FileMode.Create))
{
wordProcessor.ExportToPdf(pdfFileStream, options);
}
}
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraPrinting
Imports System.IO
'...
Using wordProcessor As New RichEditDocumentServer()
' Load a DOCX document.
wordProcessor.LoadDocument("Documents\MovieRentals.docx")
' Specify export options.
Dim options As New PdfExportOptions()
options.DocumentOptions.Author = "Mark Jones"
options.Compressed = False
options.ImageQuality = PdfJpegImageQuality.Highest
' Export the document to a stream.
Using pdfFileStream As New FileStream("Document_PDF.pdf", FileMode.Create)
wordProcessor.ExportToPdf(pdfFileStream, options)
End Using
End Using
The following code snippets (auto-collected from DevExpress Examples) contain references to the ExportToPdf(Stream, PdfExportOptions) 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.
word-document-api-examples/CS/CodeExamples/ExportActions.cs#L84
{
wordProcessor.ExportToPdf(pdfFileStream, options);
}
office-file-api-in-web-api-app/CS/BusinessObjects/Helpers.cs#L137
PdfExportOptions pdfExportOptions = SharedHelper.GetOptions(format);
server.ExportToPdf(resultStream, pdfExportOptions);
word-document-api-examples/VB/CodeExamples/ExportActions.vb#L76
Using pdfFileStream As System.IO.FileStream = New System.IO.FileStream("Document_PDF.pdf", System.IO.FileMode.Create)
wordProcessor.ExportToPdf(pdfFileStream, options)
End Using
See Also