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

Free Support Forum - aspose.com

XmlException in DocumentBuilder.InsertImage()

Dear Aspose,

We'd like to report an exception in Aspose.Words v16.6.0 for .NET that occurs while trying to convert a specific multi-page TIFF file to PDF. Upgrading to v17.4.0 doesn't help. The error we get is:

System.Xml.XmlException: Ongeldig teken in de opgegeven codering. Regel 1, positie 1.
   bij System.Xml.XmlTextReaderImpl.Throw(Exception e)
   bij System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
   bij System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
   bij System.Xml.XmlTextReaderImpl.ReadData()
   bij System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
   bij System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
   bij System.Xml.XmlTextReaderImpl.Read()
   bij System.Xml.XmlReader.MoveToContent()
   bij    ..ctor(Document , Stream , String , ??  , IWarningCallback )
   bij    .(Byte[] )
   bij    .(Byte[] )
   bij Aspose.Words.DocumentBuilder.InsertImage(Byte[] imageBytes, RelativeHorizontalPosition horzPos, Double left, RelativeVerticalPosition vertPos, Double top, Double width, Double height, WrapType wrapType)
   bij Aspose.Words.DocumentBuilder.InsertImage(Image image, RelativeHorizontalPosition horzPos, Double left, RelativeVerticalPosition vertPos, Double top, Double width, Double height, WrapType wrapType)

Apologies for the localized error message. Translated: System.Xml.XmlException: Invalid character in the designated encoding. Line 1, position 1.

We only get this error for one specific TIFF file; it triggers the error when we attempt to insert its second image frame into the Aspose.Words document. We're able to convert all other TIFF files successfully. However, we can't seem to find anything wrong with the TIFF file in question, and all viewers we've tried render the image without any problems.

I've managed to reproduce the problem on Windows 10 using a small .NET 4.5.2 project. I'll attach it and the TIFF file to the next post.

Please find attached:

  • the TIFF file that triggers the error (261387.tif);
  • a minimal solution that reproduces the problem (reproducing.zip).

The TIFF file consists of two image frames, and the 2nd one triggers the error.

I hope this is sufficient information, and thank you for your time!

Hi Rogier,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15316. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-15316) have been fixed in this Aspose.Words for .NET 17.6 update and this Aspose.Words for Java 17.6 update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.