This project has moved. For the latest updates, please go here.

Multipage PDF to ONE MULTIPAGE (!!!) Tiff

Aug 27, 2015 at 9:59 AM
Hello everyone,

my c# Code manages to create many tiff-files out of a multipage pdf. So far, so good, now I need a way - as an option - to create one multipage tiff (yes, one tiff file with MANY pages/pictures) out of a multipage pdf.

I thought I could use some guerilla tactics by trying this:
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new PointD(192, 192);

using (MagickImageCollection images = new MagickImageCollection())
{
                
                // Add all the pages of the pdf file to the collection
                images.Read(sPdf, settings);

                using (MagickImage vertical = images.Merge() )
                {
                    // save result as a png
                    vertical.Write( sPdf + ".tif");
                }
}
Too bad it merged the pages as layers!
Coordinator
Aug 27, 2015 at 10:50 AM
Edited Aug 27, 2015 at 10:51 AM
You are very close actually. You should use the write method of MagickImageCollection when you want to write multiple pages instead of a single page:
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new PointD(192, 192);

using (MagickImageCollection images = new MagickImageCollection())
{
  // Add all the pages of the pdf file to the collection
  images.Read(sPdf, settings);

  // Save result as a multipage tiff
  images.Write( sPdf + ".tif");
}