Interface IDocxToPdfConverter
- Namespace
- DocToolkit.Extensions.DependencyInjection
- Assembly
- DocToolkit.Extensions.DependencyInjection.dll
Renders a Word (.docx) package to PDF. Registered by AddDocToolkit(IServiceCollection, Action<DocToolkitOptions>?).
public interface IDocxToPdfConverter
Methods
Convert(byte[])
Renders the .docx in docx and returns PDF bytes.
byte[] Convert(byte[] docx)
Parameters
docxbyte[]
Returns
- byte[]
Exceptions
- ArgumentNullException
docxis null.- ArgumentException
docxis empty.- DocumentConversionException
The DOCX could not be rendered.
ConvertAsync(Stream, Stream, CancellationToken)
Reads a .docx from source and writes the rendered PDF to
destination. Neither stream is disposed, closed, sought or read back; the
PDF is written straight through as the renderer produces it, so nothing here ever holds the
whole rendered document in memory. The consequence of streaming is that a failure part-way
through leaves whatever had already been produced on destination.
Task ConvertAsync(Stream source, Stream destination, CancellationToken ct = default)
Parameters
sourceStreamdestinationStreamctCancellationToken
Returns
Exceptions
- ArgumentNullException
Either stream is null.
- ArgumentException
sourceis not readable or held no bytes, ordestinationis not writable.- OperationCanceledException
ctwas cancelled.- DocumentConversionException
The DOCX could not be rendered.