Merge Multiple Images
Sometimes it is necessary to merge multiple documents into a single file. Combining image files is particularly useful when digitizing paper documents — for example, when you have photographed or scanned individual pages and want to create a single, continuous PDF for easier viewing, sharing, or archiving.
Merge Multiple Images Before Saving to PDF
If you need to combine multiple images and save each image as a separate page in PDF, use the Merge method and the following code example:
Merger.Merge("DocumentOut.pdf", new string[] { "MultiFrameIn.tiff", "DocumentIn.png" });You can also merge multiple images using Fluent API and the Create method:
Merger.Create()
.From("MultiFrameIn.tiff")
.From("DocumentIn.png")
.To("DocumentOut.pdf")
.Execute();Merge Multiple Images Into One
You can also merge multiple images into one by arranging them:
- vertically
- horizontally
- or in a grid
Сustomize the layout to render multiple pages in a single output using the MultiPageLayout class.
The following code example shows how to combine multiple images into a single image, placing each image or frame in a grid layout:
ImageSaveOptions opt = new ImageSaveOptions(SaveFormat.Png);
opt.PageLayout = MultiPageLayout.Grid(2, 10, 10);
opt.PageLayout.BorderColor = Color.Black;
opt.PageLayout.BorderWidth = 1;
Merger.Create()
.From("MultiFrameIn.tiff")
.From("DocumentIn.png")
.To("DocumentOut.png", opt)
.Execute();