how can I prevent overwriting pdf in Montage?
I use Your script - and every time if I want use "Montage" pdf is overwite but if I use
images.Write(filepath) insteed - I get multipage pdf (but I cant use this format of picture)
Code: Select all
List<string> lFiles = new List<string>();
foreach (String filename in openFileDialog1.FileNames)
lFiles.Add(filename);
using (MagickImageCollection images = new MagickImageCollection())
{
int sizer = 300;
foreach (string tempFile in lFiles)
{
MagickImage magickinput = new MagickImage(tempFile);
magickinput.Quality = 70;
if (magickinput.Height > magickinput.Width)
{
magickinput.Rotate(90);
}
magickinput.Resize(sizer, 0);
magickinput.CompressionMethod = CompressionMethod.JPEG;
images.Add(magickinput);
}
tempWidth = 842 ;
tempHeight = 595 ;
MontageSettings ms = new MontageSettings();
ms.BorderWidth = 10;
ms.Geometry = new MagickGeometry(2, 2, tempWidth, tempHeight);
ms.TileGeometry = new MagickGeometry(2, 2);
ms.Label = Path.Combine(Path.GetFileName(imageFileName));
using (MagickImage montageResult = images.Montage(ms))
{
montageResult.Write(imageFileName); //image with path
}
ala