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

Free Support Forum - aspose.com

Aspose PDF to TIFF Problem

Hello ,
We get as Aspose error trying to convert the attache file to TIFF, and using compression value of Format8bpp.

This is the error:

ERROR 2013-12-02 08:27:18,503 Value of '-14' is not valid for 'red'. 'red' should be greater than or equal to 0 and less than or

equal to 255. called from ValidateInternal.
Stack trace:
at System.Drawing.Color.CheckByte(Int32 value, String name)
at System.Drawing.Color.FromArgb(Int32 alpha, Int32 red, Int32 green, Int32 blue)
at .‡...‹(ArrayList , Int32& )
at .‡...‹(ArrayList , Int32& )
at .‡...‹(ArrayList , Int32& )
at .‡...‹(ArrayList , Int32& )
at .‡...‹(ArrayList , Int32& )
at .‡...‹(ArrayList , Int32& )
at .‡...‹(ArrayList , Int32& )
at .‡...‹(ArrayList , Int32& )
at .‡...‹(ArrayList , Int32& )
at .‡..‹(Int32 )
at .‡.‹(ColorPalette )
at .†.‹(Bitmap )
at .‰.‹(Bitmap , Int32 , Int32 )
at .‰.‹(Bitmap )
at Aspose.Pdf.Devices.TiffDevice.Process(Document document, Int32 fromPage, Int32 toPage, Stream output)
at iFOREX.Server.SecureDataStore.Validators.FileConverterValidator.ConvertPDF(Byte[] data, MemoryStream stream_out) in d:

\BuildAreas\Main\Source\iFOREX Framework\iFOREX.Server\SDS\SDS.Validators\FileConverterValidator.cs:line 181
at iFOREX.Server.SecureDataStore.Validators.FileConverterValidator.ValidateInternal(Request request, ActionType actionType) in d:

\BuildAreas\Main\Source\iFOREX Framework\iFOREX.Server\SDS\SDS.Validators\FileConverterValidator.cs:line 104

This is our code, with and without conversion.

using (Aspose.Pdf.Facades.PdfConverter converter = new Aspose.Pdf.Facades.PdfConverter())
if (string.IsNullOrEmpty(asposeCompressPDF))
ColorDepth colorValue = (ColorDepth)Enum.Parse(typeof(ColorDepth), asposeCompressPDF);
if (!Enum.IsDefined(typeof(ColorDepth), colorValue))
throw new ApplicationException("Invalid Aspose Compress Parameter: ConvertCompressPDF. Allowed:

Format8bpp, Format4bpp, Format1bpp");
//Create TiffSettings object (To reduce file size, change color settings)
TiffSettings tiffSettings = new TiffSettings();
// CompressionType.LZW is the default CompressionType
tiffSettings.Compression = CompressionType.LZW;
// Allowed: 0 (default), Format8bpp, Format4bpp, Format1bpp
tiffSettings.Depth = colorValue;
converter.SaveAsTIFF(stream_out, tiffSettings);

Can you assist us?


Gizi Ben-Tovim


Hi Gizi,

Thanks for using our products.

I have tested the scenario using latest release of Aspose.Pdf for .NET 8.6.0 and as per my observations, the file is properly being converted to TIFF format. For your reference, I have also attached the resultant TIFF generated over my end. Can you please try using the latest release and in case you still face the same issue or you have any further query, please feel free to contact. We are sorry for this inconvenience.

Thanks Nayyer,

I downloaded your new version 8.6 Aspose.Pdf.DLL.
I repeated my test on the same file sent.I got the same error!
The code is here , as before.

Using Format8bpp fails as before (same error)
Using Format4bpp never ends! (looks like endless loop)
Using Format1bpp does work.

How did you get your TIFF output as 171k file?


My Code:

Aspose.Pdf.Devices.TiffSettings tiffSettings = new Aspose.Pdf.Devices.TiffSettings();

tiffSettings.Compression = Aspose.Pdf.Devices.CompressionType.LZW;

tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format8bpp;

converter.SaveAsTIFF(output_file, tiffSettings);

Hi Gizi,

Thanks for sharing the details.

In my earlier attempt, I have used the following code snippet where I have used CCITT4 as compression type and as a result, 171KB file is generated.


//open document<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/Nezikin_Test.pdf");

//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.Default;

//create TIFF device

TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);

//convert a particular page and save the image to stream

tiffDevice.Process(pdfDocument, “c:/pdftest/TIFF_output.tif”);

I have again tested the scenario where I have used ColorDepth as Format8bpp and I am able to get the same exception. For the sake of correction, I have logged this issue as PDFNEWNET-36118 in
our issue tracking system.

  • When using Format4bpp as ColorDepth, the process is completed in 54 Seconds and resultant file is properly generated.
  • When using Format1bpp as ColorDepth, the process is completed in 4 seconds.

We will further look into the details of this problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-36118) have been fixed in Aspose.Pdf for .NET 9.2.0.

The blog post for this release is created over this link

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hello Nayyer,

Seems all is fixed and working with the new PDF version.

Thanks a lot for your help,

Gizi Ben-Tovim


Hi Gizi,

Thanks for sharing the feedback. We are glad to hear that your problem is resolved. Please continue using our API and in the event of any further query, please feel free to contact.