Table of Contents

Method ConvertAsync

Namespace
LMKit.Document.Conversion
Assembly
LM-Kit.NET.dll

ConvertAsync(byte[], bool, CancellationToken)

Converts an EML file (as a byte array) into a PDF attachment.

public static Task<Attachment> ConvertAsync(byte[] emlData, bool stripQuotes = false, CancellationToken cancellationToken = default)

Parameters

emlData byte[]

The EML file content as a byte array.

stripQuotes bool

When true, quoted and reply content is removed from the email body.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task<Attachment>

Examples

byte[] emlBytes = File.ReadAllBytes("invoice.eml");
Attachment pdf = EmlToPdf.Convert(emlBytes);

ConvertAsync(string, bool, CancellationToken)

Converts an EML file at the specified path into a PDF attachment.

public static Task<Attachment> ConvertAsync(string inputPath, bool stripQuotes = false, CancellationToken cancellationToken = default)

Parameters

inputPath string

The file system path to the EML file.

stripQuotes bool

When true, quoted and reply content is removed from the email body.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task<Attachment>

Examples

Attachment pdf = EmlToPdf.Convert("message.eml");
File.WriteAllBytes("message.pdf", pdf.GetData());
Share