Interface IXlsxToPdfConverter
- Namespace
- DocToolkit.Extensions.DependencyInjection
- Assembly
- DocToolkit.Extensions.DependencyInjection.dll
Renders an Excel (.xlsx) workbook to PDF. Registered by AddDocToolkit(IServiceCollection, Action<DocToolkitOptions>?).
public interface IXlsxToPdfConverter
Methods
Convert(byte[])
Renders the .xlsx in xlsx and returns PDF bytes.
byte[] Convert(byte[] xlsx)
Parameters
xlsxbyte[]
Returns
- byte[]
Exceptions
- ArgumentNullException
xlsxis null.- ArgumentException
xlsxis empty.- DocumentConversionException
It could not be rendered.
ConvertAsync(Stream, Stream, CancellationToken)
Reads a .xlsx 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 a failure part-way 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
It could not be rendered.