Back to Devexpress

RichEditDocumentServer.ExportToPdf(String, PdfExportOptions) Method

officefileapi-devexpress-dot-xtrarichedit-dot-richeditdocumentserver-dot-exporttopdf-x28-system-dot-string-devexpress-dot-xtraprinting-dot-pdfexportoptions-x29.md

latest3.2 KB
Original Source

RichEditDocumentServer.ExportToPdf(String, PdfExportOptions) Method

SECURITY-RELATED CONSIDERATIONS

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 content of the RichEditControl to the specified file path in PDF format, applying PDF-specific options.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public virtual void ExportToPdf(
    string fileName,
    PdfExportOptions pdfExportOptions
)
vb
Public Overridable Sub ExportToPdf(
    fileName As String,
    pdfExportOptions As PdfExportOptions
)

Parameters

NameTypeDescription
fileNameString

A String which specifies the file name (including the full path) for the created PDF file.

| | pdfExportOptions | PdfExportOptions |

A PdfExportOptions object which specifies the PDF export options.

|

Remarks

PDF Export features and limitations are detailed in the following document: Export to PDF

csharp
using (var wordProcessor = new RichEditDocumentServer()) {
  wordProcessor.LoadDocument("Documents//MovieRentals.docx", DocumentFormat.Docx);

  // Specify export options:
  PdfExportOptions options = new PdfExportOptions();
  options.DocumentOptions.Author = "Mark Jones";
  options.Compressed = false;
  options.ImageQuality = PdfJpegImageQuality.Highest;

  // Export the document to the file:
  wordProcessor.ExportToPdf("Document_PDF.pdf", options);
}

System.Diagnostics.Process.Start("Document_PDF.pdf");
vb
Using wordProcessor = New RichEditDocumentServer()
  wordProcessor.LoadDocument("Documents//MovieRentals.docx", DocumentFormat.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 the file:
  wordProcessor.ExportToPdf("Document_PDF.pdf", options)
End Using

System.Diagnostics.Process.Start("Document_PDF.pdf")

See Also

RichEditDocumentServer Class

RichEditDocumentServer Members

DevExpress.XtraRichEdit Namespace