officefileapi-devexpress-dot-spreadsheet-dot-iworkbook-dot-exporttopdf-x28-system-dot-io-dot-stream-devexpress-dot-xtraprinting-dot-pdfexportoptions-x29.md
Exports the workbook to the specified stream in PDF format using the specified options.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
void ExportToPdf(
Stream stream,
PdfExportOptions options
)
Sub ExportToPdf(
stream As Stream,
options As PdfExportOptions
)
| Name | Type | Description |
|---|---|---|
| stream | Stream |
A Stream object to which the created PDF file should be sent.
| | options | PdfExportOptions |
A PdfExportOptions object specifying export settings.
|
The following code snippet exports the spreadsheet document as a PDF file with the specified settings:
IWorkbook workbook = spreadsheetControl1.Document;
PdfExportOptions options = new PdfExportOptions();
options.DocumentOptions.Author = "John Doe";
options.DocumentOptions.Title = "Breakeven Analysis";
options.ImageQuality = PdfJpegImageQuality.Medium;
options.ExportBookmarks = false;
using (FileStream pdfFileStream = new FileStream("Documents\\Document_PDF.pdf", FileMode.Create)) {
workbook.ExportToPdf(pdfFileStream, options);
}
Dim workbook As IWorkbook = spreadsheetControl1.Document
Dim options As New PdfExportOptions()
options.DocumentOptions.Author = "John Doe"
options.DocumentOptions.Title = "Breakeven Analysis"
options.ImageQuality = PdfJpegImageQuality.Medium
options.ExportBookmarks = False
Using pdfFileStream As New FileStream("Documents\Document_PDF.pdf", FileMode.Create)
workbook.ExportToPdf(pdfFileStream, options)
End Using
See Also