Table of Contents

Method ConvertToFile

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

ConvertToFile(IEnumerable<string>, string)

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

public static void ConvertToFile(IEnumerable<string> imagePaths, string outputPath)

Parameters

imagePaths IEnumerable<string>

Paths to the source image files.

outputPath string

Path where the output PDF will be written.

Examples

using LMKit.Document.Pdf;

ImageToPdf.ConvertToFile(
    new[] { "receipt1.jpg", "receipt2.jpg" },
    "receipts.pdf");

Exceptions

ArgumentNullException

Thrown when imagePaths or outputPath is null.

ArgumentException

Thrown when no image paths are provided.

FileNotFoundException

Thrown when any image file does not exist.

ConvertToFile(IEnumerable<Attachment>, string)

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

public static void ConvertToFile(IEnumerable<Attachment> images, string outputPath)

Parameters

images IEnumerable<Attachment>

The source image attachments.

outputPath string

Path where the output PDF will be written.

Examples

using LMKit.Data;
using LMKit.Document.Conversion;

var images = new[]
{
    new Attachment("invoice-page1.png"),
    new Attachment("invoice-page2.png")
};

ImageToPdf.ConvertToFile(images, "invoice.pdf");

Exceptions

ArgumentNullException

Thrown when images or outputPath is null.

ArgumentException

Thrown when no images are provided.