Table of Contents

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

xlsx byte[]

Returns

byte[]

Exceptions

ArgumentNullException

xlsx is null.

ArgumentException

xlsx is 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

source Stream
destination Stream
ct CancellationToken

Returns

Task

Exceptions

ArgumentNullException

Either stream is null.

ArgumentException

source is not readable or held no bytes, or destination is not writable.

OperationCanceledException

ct was cancelled.

DocumentConversionException

It could not be rendered.