We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Groupdocs merger 20.8 error on merging tiff files

Hello all,

I am using groupdocs merger 20.8 in my application, here I have a situation where I have to merge 2 pdf’s, attached a zip file which contains tiff files RV-21-105 after annotation.zip (75.7 KB)

while merging I am getting below error,

The given key was not present in the dictionary.

here is my code

using (Merger merger = new Merger(filePath1))// error on this line
{
    merger.Join(filePath2, joinOptions);
    merger.Save(filePathOut);
}

@Niteen_Jadhav

TIFF file format is not mentioned in the supported file formats list. However, we are investigating the possibility to merge these files. Your investigation ticket ID is MERGERNET-1293.

Hello,

Thank you for your timely response,

I am thinking to do something like below,

  1. Will convert the tiff files into pdf.
  2. Merge the pdf(converted tiff)
  3. Convert the pdf into tiff.
1 Like

@Niteen_Jadhav

We converted the provided TIFF files to PDF using GroupDocs.Conversion for .NET.

//C# code
using (Converter converter = new Converter("source tiff"))
{
    PdfConvertOptions options = new PdfConvertOptions(); 
    converter.Convert(@"D:/output.pdf", options); 
}

Then merged the PDF files using GroupDocs.Merger for .NET.

//C# code
using (Merger merger = new Merger("source pdf"))
{
    // Add another PDF file to merge
    merger.Join("second pdf");
    // Merge PDF files and save result
    merger.Save("output");
}

Later, converted PDF back to TIFF using Conversion API.

//C# code
string outputFolder = @"D:/New folder/";
string outputFileTemplate = Path.Combine(outputFolder, "converted-page-{0}.tiff");
GroupDocs.Conversion.Contracts.SavePageStream getPageStream = page => new FileStream(string.Format(outputFileTemplate, page), FileMode.Create);
// Load the source PDF file
using (Converter converter = new GroupDocs.Conversion.Converter("merged pdf"))
{
    // Set the convert options for TIFF format
    ImageConvertOptions options = new ImageConvertOptions { Format = GroupDocs.Conversion.FileTypes.ImageFileType.Tiff };
    // Convert to TIFF format
    converter.Convert(getPageStream, options);
}
Console.WriteLine("\nConversion to TIFF completed successfully. \nCheck output in {0}", outputFolder);

Please take a look at this output.zip (677.6 KB).