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
imagePathsIEnumerable<string>Paths to the source image files.
outputPathstringPath 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
imagePathsoroutputPathisnull.- 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
imagesIEnumerable<Attachment>The source image attachments.
outputPathstringPath 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
imagesoroutputPathisnull.- ArgumentException
Thrown when no images are provided.