Aspose.pdf - Convert Multiple-Images Tiff File to PDF using C#

Hi Team,

Good day!!!

it would be helpful Could you please advise Aspose.PDF can convert multiple-images tiff file to a PDF? If it can, please post c# code.

form single folder to read multiple tiff file later convert to pdf.

Thank you

@Vicky2001

Please use the below code snippet to generate PDF from a Multi-Page TIFF image:

Document pdf1 = new Document();

FileStream ms = new FileStream(dataDir + "Page_1_2_3.tiff", FileMode.Open);
Bitmap myimage = new Bitmap(ms);
FrameDimension dimension = new FrameDimension(myimage.FrameDimensionsList[0]);
int frameCount = myimage.GetFrameCount(dimension);

for (int frameIdx = 0; frameIdx <= frameCount - 1; frameIdx++)
{
 Page sec = pdf1.Pages.Add();
 myimage.SelectActiveFrame(dimension, frameIdx);
 MemoryStream currentImage = new MemoryStream();
 myimage.Save(currentImage, ImageFormat.Tiff);
 if (myimage.Width > myimage.Height)
 {
  sec.PageInfo.IsLandscape = true;
 }
 else
 {
  sec.PageInfo.IsLandscape = false;
 }
 sec.PageInfo.Margin = new MarginInfo(0, 0, 0, 0);
 sec.PageInfo.Height = myimage.Height;
 sec.PageInfo.Width = myimage.Width;
 Aspose.Pdf.Image imageht = new Aspose.Pdf.Image();
 imageht.ImageStream = currentImage;
 sec.Paragraphs.Add(imageht);
}
pdf1.Save(dataDir + "TifftoPDF.pdf");