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

Free Support Forum - aspose.com

TIF conversion is not happening

Hi Team,

We are trying to convert a pdf to tiff.

public static System.Drawing.Image[] ConvertPDFtoMultiPageTiff(string OutputFolder, string FullInputFileName)
{
System.Drawing.Image[] sourceImages = null;

try
{

Document pdfDocument = new Document(FullInputFileName);
//create Resolution object
Resolution resolution = new Resolution(300);
//create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();

tiffSettings.Compression = CompressionType.CCITT4;
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format8bpp;


if (tiffSettings.Shape == ShapeType.Landscape)
tiffSettings.Shape = ShapeType.Portait;
tiffSettings.SkipBlankPages = false;
//tiffSettings.Brightness = .40f;

Stream output = null;
sourceImages = new System.Drawing.Image[pdfDocument.Pages.Count];
//create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);


for (int page = 1; page <= pdfDocument.Pages.Count; page++)
{
Aspose.Pdf.ColorType pageColorType = pdfDocument.Pages[page].ColorType;
if (pageColorType == ColorType.Rgb)
{
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;
}

else
{
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp;
}

output = new MemoryStream();
//tiffDevice.Process(pdfDocument, page, page, Path.Combine(OutputFolder, String.Concat(Path.GetFileNameWithoutExtension(FullInputFileName), “.”,page.ToString().PadLeft(3, ‘0’))));

tiffDevice.Process(pdfDocument,page,page, output);


sourceImages[page - 1] = System.Drawing.Image.FromStream(output);

sourceImages[page-1].Save(Path.Combine(OutputFolder, String.Concat(Path.GetFileNameWithoutExtension(FullInputFileName), “.”, page.ToString().PadLeft(3, ‘0’))));

output = null;

}




}
catch (Exception ex)
{
sourceImages = null;
throw new Exception(String.Format(“Error in splitTiffPages: {0}”, ex.Message));
}


return sourceImages;


This is the code we are using.
But when i debugg the code
for (int page = 1; page <= pdfDocument.Pages.Count; page++)
{
Aspose.Pdf.ColorType pageColorType = pdfDocument.Pages[page].ColorType;

at this point the application is getting hanged while checking the color type.
Can you please check this?

Regards
Anish

Hi Anish,


Thanks for your inquiry. While testing the scenario with your shared document, we have noticed that API hangs on ColorType and logged a ticket PDFNEWNET-38008 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.


We are sorry for the inconvenience caused.


Best Regards,

Hi Tilal Ahmad,
Can I get an ETA for this issue to share my customer?
Regards
Anish

Hi Anish,

Thanks for your inquiry. I am afraid we have recently noticed the issue and yet it is pending for investigation due to the issues already under investigation. As soon as its investigation is completed then we will be in a good position to share ETA for the fix. We will keep you updated about the issue resolution progress.

Thanks for your patience and cooperation.

Best Regards,

Hi Tilal Ahmad,

Is there any progress in this issue?

Regards
Anish

Hi Anish,


The issue is still pending for review because the team is busy fixing already reported issues. However, as soon as we have made some definite progress towards the resolution of this issue, we will let you know. Your patience and comprehension is greatly appreciated in this regard.

The issues you have found earlier (filed as PDFNET-38008) have been fixed in Aspose.PDF for .NET 21.8.