Hi Team,
Good day!!!
unable to convert TIF to PDF.
it would be helpful Could you please suggest me Aspose.PDF convert TIF file to a PDF? If it can, could you please post c# code.
It is TIF to PDF?
Thank you.
Hi Team,
Good day!!!
unable to convert TIF to PDF.
it would be helpful Could you please suggest me Aspose.PDF convert TIF file to a PDF? If it can, could you please post c# code.
It is TIF to PDF?
Thank you.
We have responded to your other similar inquiry in this thread where we also shared a sample code snippet to convert TIFF to PDF. Please check it and follow up there.
Hi @asad.ali
Good day!!!
unable to convert TIF to PDF… Not TIFF to PDF it is TIF to PDF
We have TIF file we need to convert that pdf format. Not TIFF file it is TIF file.
i have attached sample file for your reference
it would be helpful Could you please suggest me Aspose.PDF convert TIF file to a PDF? If it can, could you please post c# code.
Thanks.New doc 31-Jan-2021 9.10 AM (2).zip (858.1 KB)
The code snippet which we shared can be used for both TIFF and TIF formats. We used the same code snippet using Aspose.PDF for .NET 21.8 in our environment and generated a PDF document successfully from it. Please check attached output file for your kind reference:
Document pdf1 = new Document();
FileStream ms = new FileStream(dataDir + "1.tif", 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");
TifftoPDF.pdf (731.1 KB)