Table of Contents

Method Convert

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

Convert(IEnumerable<string>)

Converts one or more image files into a single PDF attachment, with each image on its own page.

public static Attachment Convert(IEnumerable<string> imagePaths)

Parameters

imagePaths IEnumerable<string>

Paths to the source image files.

Returns

Attachment

A new Attachment containing the generated PDF.

Examples

using LMKit.Data;
using LMKit.Document.Pdf;

Attachment pdf = ImageToPdf.Convert(
    new[] { "photo1.jpg", "photo2.png" });
Console.WriteLine($"Created PDF with {pdf.PageCount} pages");

Exceptions

ArgumentNullException

Thrown when imagePaths is null.

ArgumentException

Thrown when no image paths are provided.

FileNotFoundException

Thrown when any image file does not exist.

Convert(IEnumerable<Attachment>)

Converts one or more image attachments into a single PDF attachment, with each image on its own page.

public static Attachment Convert(IEnumerable<Attachment> images)

Parameters

images IEnumerable<Attachment>

The source image attachments.

Returns

Attachment

A new Attachment containing the generated PDF.

Examples

using LMKit.Data;
using LMKit.Document.Pdf;

var img1 = new Attachment("photo1.jpg");
var img2 = new Attachment("photo2.png");

Attachment pdf = ImageToPdf.Convert(new[] { img1, img2 });
Console.WriteLine($"Created PDF with {pdf.PageCount} pages");

Exceptions

ArgumentNullException

Thrown when images is null.

ArgumentException

Thrown when no images are provided.