API Reference
WordPdfConverterExtensions
Provides extension methods for converting WordDocument instances to PDF files.
Inheritance
- Object
- WordPdfConverterExtensions
Methods
public static PdfSaveResult SaveAsPdf(WordDocument document, String path, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #PdfSaveResultSaves the specified WordDocument as a PDF at the given path.
Parameters
- document OfficeIMO.Word.WordDocument
- The document to convert.
- path System.String
- The output PDF file path.
- options OfficeIMO.Word.Pdf.WordToPdfOptions = null
- Optional PDF configuration.
- cancellationToken System.Threading.CancellationToken = default
- Cancellation observed during conversion.
public static PdfSaveResult SaveAsPdf(WordDocument document, Stream stream, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #PdfSaveResultSaves the specified WordDocument as a PDF to the provided stream.
Parameters
- document OfficeIMO.Word.WordDocument
- The document to convert.
- stream System.IO.Stream
- The output stream to receive the PDF data.
- options OfficeIMO.Word.Pdf.WordToPdfOptions = null
- Optional PDF configuration.
- cancellationToken System.Threading.CancellationToken = default
- Cancellation observed during conversion.
public static async Task<PdfSaveResult> SaveAsPdfAsync(WordDocument document, String path, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #Task<PdfSaveResult>Saves the specified WordDocument as a PDF at the given path asynchronously.
Parameters
- document OfficeIMO.Word.WordDocument
- The document to convert.
- path System.String
- The output PDF file path.
- options OfficeIMO.Word.Pdf.WordToPdfOptions = null
- Optional PDF configuration.
- cancellationToken System.Threading.CancellationToken = default
- A token to observe while waiting for the task to complete.
Returns
The saved PDF output result with conversion and pipeline diagnostics.
public static async Task<PdfSaveResult> SaveAsPdfAsync(WordDocument document, Stream stream, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #Task<PdfSaveResult>Saves the specified WordDocument as a PDF to the provided stream asynchronously.
Parameters
- document OfficeIMO.Word.WordDocument
- The document to convert.
- stream System.IO.Stream
- The output stream to receive the PDF data.
- options OfficeIMO.Word.Pdf.WordToPdfOptions = null
- Optional PDF configuration.
- cancellationToken System.Threading.CancellationToken = default
- A token to observe while waiting for the task to complete.
Returns
The saved PDF output result with conversion and pipeline diagnostics.
public static PdfSaveResult SaveAsPdfResult(WordDocument document, String path, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #PdfSaveResultAttempts to save the specified WordDocument as a PDF file and returns output diagnostics instead of throwing.
Parameters
- arg1 OfficeIMO.Word.WordDocument
- arg2 System.String
- arg3 OfficeIMO.Word.Pdf.WordToPdfOptions = null
- arg4 System.Threading.CancellationToken = default
public static PdfSaveResult SaveAsPdfResult(WordDocument document, Stream stream, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #PdfSaveResultAttempts to write the specified WordDocument as a PDF to a stream and returns output diagnostics instead of throwing.
Parameters
- arg1 OfficeIMO.Word.WordDocument
- arg2 System.IO.Stream
- arg3 OfficeIMO.Word.Pdf.WordToPdfOptions = null
- arg4 System.Threading.CancellationToken = default
public static async Task<PdfSaveResult> SaveAsPdfResultAsync(WordDocument document, String path, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #Task<PdfSaveResult>Attempts to save the specified WordDocument as a PDF file asynchronously and returns output diagnostics instead of throwing.
Parameters
- arg1 OfficeIMO.Word.WordDocument
- arg2 System.String
- arg3 OfficeIMO.Word.Pdf.WordToPdfOptions = null
- arg4 System.Threading.CancellationToken = default
public static async Task<PdfSaveResult> SaveAsPdfResultAsync(WordDocument document, Stream stream, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #Task<PdfSaveResult>Attempts to write the specified WordDocument as a PDF to a stream asynchronously and returns output diagnostics instead of throwing.
Parameters
- arg1 OfficeIMO.Word.WordDocument
- arg2 System.IO.Stream
- arg3 OfficeIMO.Word.Pdf.WordToPdfOptions = null
- arg4 System.Threading.CancellationToken = default
public static Byte[] ToPdfBytes(WordDocument document, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #Byte[]Converts the specified WordDocument to PDF bytes.
Parameters
- document OfficeIMO.Word.WordDocument
- The document to convert.
- options OfficeIMO.Word.Pdf.WordToPdfOptions = null
- Optional PDF configuration.
- cancellationToken System.Threading.CancellationToken = default
- Cancellation observed during conversion.
Returns
The generated PDF as a byte array.
Examples
byte[] pdf = document.ToPdfBytes();
public static PdfDocument ToPdfDocument(WordDocument document, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #PdfDocumentConverts the specified WordDocument to a first-party OfficeIMO PDF document model.
Parameters
- document OfficeIMO.Word.WordDocument
- The document to convert.
- options OfficeIMO.Word.Pdf.WordToPdfOptions = null
- Optional PDF configuration.
- cancellationToken System.Threading.CancellationToken = default
- Cancellation observed at document-section and element boundaries.
Returns
The generated first-party PDF document model.
public static PdfDocumentConversionResult ToPdfDocumentResult(WordDocument document, WordToPdfOptions options = null, CancellationToken cancellationToken = default) #PdfDocumentConversionResultConverts the specified WordDocument to a PDF document and returns conversion diagnostics with it.
Parameters
- document OfficeIMO.Word.WordDocument
- options OfficeIMO.Word.Pdf.WordToPdfOptions = null
- cancellationToken System.Threading.CancellationToken = default