officefileapi-devexpress-dot-xtrarichedit-dot-richeditdocumentserver-dot-exporttopdf-x28-system-dot-string-x29.md
Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.
Exports the document content to the specified file path in PDF format.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
public virtual void ExportToPdf(
string fileName
)
Public Overridable Sub ExportToPdf(
fileName As String
)
| Name | Type | Description |
|---|---|---|
| fileName | String |
A String which specifies the file name (including the full path) for the created PDF file.
|
PDF Export features and limitations are detailed in the following document: Export to PDF.
Use the PdfExportOptions class instance to specify export settings. Pass this object as the method parameter.
using (var wordProcessor = new RichEditDocumentServer()) {
wordProcessor.LoadDocument("Documents//MovieRentals.docx", DocumentFormat.Docx);
// Export the document to the file:
wordProcessor.ExportToPdf("Document_PDF.pdf");
}
System.Diagnostics.Process.Start("Document_PDF.pdf");
Using wordProcessor = New RichEditDocumentServer()
wordProcessor.LoadDocument("Documents//MovieRentals.docx", DocumentFormat.Docx)
' Export the document to the file:
wordProcessor.ExportToPdf("Document_PDF.pdf")
End Using
The following code snippets (auto-collected from DevExpress Examples) contain references to the ExportToPdf(String) 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-enable-automatic-hyphenation/CS/Program.cs#L39
//Export the result to the PDF format
wordProcessor.ExportToPdf("Result.pdf");
word-document-api-use-track-changes/CS/word-processing-document-api-track-changes/Program.cs#L51
documentProcessor.ExportToPdf("DocumentWithAppliedRevisions.pdf");
System.Diagnostics.Process.Start("DocumentWithAppliedRevisions.pdf");
word-document-api-examples/CS/CodeExamples/ExportActions.cs#L98
// Save the document as a PDF file.
wordProcessor.ExportToPdf("Document_PDF.pdf");
word-document-api-enable-automatic-hyphenation/VB/Program.vb#L35
'Export the result to the PDF format
wordProcessor.ExportToPdf("Result.pdf")
word-document-api-use-track-changes/VB/word-processing-document-api-track-changes/Program.vb#L49
documentProcessor.ExportToPdf("DocumentWithAppliedRevisions.pdf")
System.Diagnostics.Process.Start("DocumentWithAppliedRevisions.pdf")
word-document-api-examples/VB/CodeExamples/ExportActions.vb#L89
' Save the document as a PDF file.
wordProcessor.ExportToPdf("Document_PDF.pdf")
' Show the resulting PDF file.
See Also