Aspose PDF latest DLL having issues

I am using below code to check converted images matches with PDF document


Aspose.Pdf.Devices.TiffSettings tiffsettings = new Aspose.Pdf.Devices.TiffSettings();
tiffsettings.Compression = (Aspose.Pdf.Devices.CompressionType)Enum.Parse(typeof(Aspose.Pdf.Devices.CompressionType), encoder.Compression.ToString(), true);
tiffsettings.Depth = settings.Depth;
tiffsettings.SkipBlankPages = true;
//for (int i = 0; i < converter.PageCount; i++)
//{
MemoryStream tempStream = new MemoryStream();
try
{
converter.SaveAsTIFF(tempStream, tiffsettings);

}
catch
{
InputData.Position = 0;
tempStream = new MemoryStream();
converter.BindPdf(InputData);
converter.SaveAsTIFF(tempStream, tiffsettings);
}
tempStream.Position = 0;
converter.Close();

if (!ScalePages)
{
BitmapData = tempStream;
return;
}

TiffBitmapEncoder tempEncoder = new TiffBitmapEncoder();
tempEncoder.Compression = encoder.Compression;

TiffBitmapDecoder tempDecoder = new TiffBitmapDecoder(tempStream, BitmapCreateOptions.None, BitmapCacheOption.None);

if (CompareImageCount)
{
if (PdfPageCount != tempDecoder.Frames.Count)
{
PdfPageCount = 0;
throw new Exception(“Output Image Missing Pages”);
}
}

PDFs working well till 16.10 version are not working after that.

Please fix this issue.

Hi Gowtham,


Thanks for contacting support.

We are truly sorry for the inconvenience which you are facing. I have tried to test the scenario with the code snippet which you have shared but I was unable to execute it. It seems that some parts of code are missing. In order to understand the problem that you are facing we need a working code snippet along with sample input/output file(s) and we will really appreciate if you please share them with us. This way we can try to replicate the issue in our environment and update you accordingly.


Best Regards,

I have shared you the code that is needed for PDF to Tiff conversion.I will attach the whole .cs file hope that would be better.Also i am attaching the PDF file that is Used.


Hi Gowtham,

Thanks for sharing code and input file.

I have tried to execute the code snippet which you have shared but I am afraid that there are some missing classes in the code.

Gowtham5555:

I have shared you the code that is needed for PDF to Tiff conversion

I have tried to convert your attached PDF file into TIFF using Aspose.Pdf for .NET 17.3.0 which is the latest version of the API and I did not notice any issue. The TIFF file has been generated successfully. However by looking into your code I have noticed that you are using Aspose.Pdf.Facades approach. Please note that Aspose.Pdf.Facades is an old approach and is going to be obsolete soon. It is highly recommended to use new DOM (Document Object Model) approach. Please check the following code snippet where I followed new DOM approach for conversion process.

TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.LZW;
tiffSettings.Depth = ColorDepth.Default;
tiffSettings.SkipBlankPages = false;
using (Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(dataDir + "GuidelinesFor201617.pdf"))
{
    TiffDevice tiffPdfDevice = new TiffDevice(new Resolution(300, 300), tiffSettings);
    tiffPdfDevice.Process(pdfDoc, dataDir + "PDFToTIFF_out.tif");
}

I have also attached the generated output for your reference. Please try using new DOM approach for conversion process and in case if you still face any problem please share a sample console based application so that we can try to replicate issue in our environment and address it accordingly.

Best Regards,