Problem with Tiff images

Hello

We got a complained from a client using our system. It seems the Viewer (through the Annotations DLL) can not open a TIFF image because of an error that comes up. Here below is that stack trace. What pops out is: “Index was outside the bounds of the array” and “Image export failed”.

We have noticed that some TIFF images seem to be a problem. Do you know what the issue might be? I can unfortunately not share the document with you as this one is confidential. All other documents with the client were fine oddly enough.

Best regards
Robert Badi

[IndexOutOfRangeException: Index was outside the bounds of the array.]

..() +1005

..(StreamContainer , Rectangle ) +259
   .[1].(Rectangle ) +174
   ..LoadRawData(Rectangle , RawDataSettings , IPartialRawDataLoader ) +85
   ..LoadPartialPixels(Rectangle , IPartialPixelLoader ) +164
   Aspose.Imaging..(Rectangle ) +53
   .

.(Rectangle ,  ,  , Int32 , Int32 ) +1238

.(Rectangle ,  ) +46
   Aspose.Imaging.RasterImage.LoadPixelsInternal(Rectangle rectangle, IPartialPixelLoader pixelLoader) +87
   Aspose.Imaging.RasterImage.(Rectangle , Color[] , Boolean , IPartialPixelLoader ) +95
   Aspose.Imaging.RasterImage.(Rectangle , Boolean , IPartialPixelLoader ) +681
   Aspose.Imaging.RasterImage.LoadPixels(Rectangle rectangle) +189
   ..(Rectangle ) +812
   .

.(Rectangle ,  ,  , Int32 , Int32 ) +1238

.(Rectangle ,  ) +46
   .ƒ.(TiffStream , Rectangle , IPartialPixelLoader ) +224
   ..LoadPartialPixels(Rectangle , IPartialPixelLoader ) +158
   Aspose.Imaging..(Rectangle ) +53
   .

.(Rectangle ,  ,  , Int32 , Int32 ) +1238

.(Rectangle ,  ) +46
   Aspose.Imaging.RasterImage.LoadPixelsInternal(Rectangle rectangle, IPartialPixelLoader pixelLoader) +87
   Aspose.Imaging.RasterImage.(Rectangle , Color[] , Boolean , IPartialPixelLoader ) +95
   Aspose.Imaging.RasterImage.(Rectangle , Boolean , IPartialPixelLoader ) +681
   Aspose.Imaging.RasterImage.LoadPartialPixels(Rectangle desiredRectangle, IPartialPixelLoader pixelLoader) +113
   Aspose.Imaging.FileFormats.Jpeg.JpegImage.(RasterImage , Stream , JFIFData , JpegExifData , JpegOptions ) +764
   .‚.Export(Image , Stream , ImageOptionsBase ) +105
   Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase) +241

[ImageSaveException: Image export failed.]
   Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase) +460
   ?? .Perform() +556
   Groupdocs.Engine.Documents.Document`2.SaveAs(String path, FileType type, SaverOptions options) +501
   Groupdocs.Engine.Documents.TiffDocument.SaveAs(String path, FileType type, SaverOptions options) +40
   Groupdocs.Engine.Viewing.ViewingDocumentFactory.CreatePdf(String filePath, IFileStorage storage, String outputPath, IFileStorage tempStorage, String modificationTimeString) +534
   Groupdocs.Engine.Viewing.ViewingService.OpenDocument(String filePath, Boolean usePdf, Boolean splitPdf, Boolean checkFileDateTime, Boolean isLicensed) +395
   Groupdocs.Engine.Viewing.ViewingService.OpenDocument(Boolean usePdf, Boolean splitPdf, Boolean checkFileDateTime, Boolean isLicensed) +45
   Groupdocs.Engine.Viewing.[1]() +61
   Groupdocs.Engine.Viewing.ViewingService.[1](String [1], ViewingOptions
   , String ) +2343
   Groupdocs.Engine.Viewing.ViewingService.GeneratePageImages(String filePath, ViewingOptions options, String outputFolder) +465
   Groupdocs.Web.UI.Handlers.ViewDocumentHandler.ProcessRequest(HttpContext context) +3096
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34249

Hi Robert,

Thank you for asking. If I understand you correctly you use GroupDocs.Annotation library to view the document - is it correct? If yes then please share with me the source code example of the web page with annotation that I can check the Annotation widget options.

Thank you.

Hello Pavel

Thank you for your response. You understood correctly. Here is a zip file with the page and it’s codebehind. The Viewer.ClientCode() options are in the codebehind.

Best regards

Robert Badi

Hi Robert,

Thank you for the code example. Please try to set the stream position to 0 before using it in the Viewer widget. For example:

_fs.Position = 0;

Unfortunately without the document I can’t reproduce the issue. Also from your code I can’t see Annotation code so wonder does you really need the Annotation library, if no you can migrate to the latest Viewer and the issue should be resolved in it.

Best regards.

Hi Pavel

Thank you for your suggestion. I have changed the code on my end as you suggest and we will try the changed version with our client at an opportune moment.

As to you last question we are using the Groupdocs.Viewer in this case that is included in the Annotations library and therefore reference that.

Best regards

Robert Badi

Hi Robert,

Thank you for the notification. Yes, I understand how you use the Viewer, but maybe it will be better to use the Viewer library it self instead of using it from the Annotation library.

Best regards.