Method FromImages
- Namespace
- SoftZenPdf
- Assembly
- SoftZenPdf.dll
FromImages(IEnumerable<string>, ImagePageOptions?)
Creates a document with a page for each image: one page per image file, and one per page of a multi-page TIFF.
public static PdfDocument FromImages(IEnumerable<string> paths, ImagePageOptions? options = null)
Parameters
pathsIEnumerable<string>The image files, in page order. JPEG, PNG, GIF, BMP and TIFF are supported.
optionsImagePageOptionsPage size, margin and fit for every page; null makes each page the size of its image.
Returns
- PdfDocument
A new, unsaved document.
Examples
var document = PdfDocument.FromImages(["scan-1.tif", "photo.jpg"], new ImagePageOptions { PageSize = PageSize.A4, Margin = 36 });
document.Save("images.pdf");
Exceptions
- NotSupportedException
A file's format, or a variant of it, is not supported.
- InvalidDataException
A file is corrupt.