Merging TIFF files in multi page with C#
Posted: 2019-03-20T09:51:18-07:00
Hi there! My name is Sofia and I'm trying to merge various TIFF files into a multi page one.
What I want to do is convert PDF to TIFF and then, these TIFF files, merge them.
I already can convert PDF to TIFF with this code (using ImageMagick):
Now I want to merge those files into a multi page TIFF one.
I know how to do it using command line, but I don't know how to do it in C#. If someone knows or can help me, please answer this post.
Thank you in advance!
Sofia Rodrigues
What I want to do is convert PDF to TIFF and then, these TIFF files, merge them.
I already can convert PDF to TIFF with this code (using ImageMagick):
Code: Select all
public void PDFToTIFF(string output)
{
MagickReadSettings settings = new MagickReadSettings();
// Settings the density to 500 dpi will create an image with a better quality
settings.Density = new Density(500);
string[] ficheiros = GetFiles();
foreach (string fich in ficheiros)
{
string fichwithout = Path.GetFileNameWithoutExtension(fich);
string path = Path.Combine(output, fichwithout);
using (MagickImageCollection images = new MagickImageCollection())
{
images.Read(fich);
foreach (MagickImage image in images)
{
settings.Height = image.Height;
settings.Width = image.Width;
image.Format = MagickFormat.Tiff;
image.Write(path + ".tiff");
image.Dispose();
}
images.Dispose();
}
}
}
I know how to do it using command line, but I don't know how to do it in C#. If someone knows or can help me, please answer this post.
Thank you in advance!
Sofia Rodrigues