In our mvc asp.net application on Azure we use 6.5.15 (professional) SprePdf.
When we try to open large file (27 pages) 4 MB we receive exception ..
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Spire.Pdf.Exceptions.PdfDocumentException: Invalid/Unknown/Unsupported format
at spr?.?(Int32 A_0)
at spr?.?(String A_0)
at spr?.?(Dictionary`2 A_0, spr? A_1)
at spr?.?(Stream A_0, Boolean A_1)
at spr?..ctor(Stream A_0)
at Spire.Pdf.PdfDocument..ctor(Stream stream)
at Billennium.Spire.SpirePdfFactory.Create(Stream stream) in E:\agent\wd\3\s\Billennium.Spire\SpirePdfFactory.cs:line 32
But when we check it on local development environment it work but we notice (catched) exception :
System.Text.DecoderFallbackException: 'Unable to translate bytes [ED][96] at index 2 from specified code page to Unicode.'
mscorlib.dll!System.Text.UTF8Encoding.GetChars(byte* bytes, int byteCount, char* chars, int charCount, System.Text.DecoderNLS baseDecoder) Unknown
mscorlib.dll!System.Text.DecoderNLS.Convert(byte* bytes, int byteCount, char* chars, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) Unknown
mscorlib.dll!System.Text.DecoderNLS.Convert(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) Unknown
System.Xml.dll!System.Xml.XmlTextReaderImpl.GetChars(int maxCharsCount) Unknown
System.Xml.dll!System.Xml.XmlTextReaderImpl.ReadData() Unknown
System.Xml.dll!System.Xml.XmlTextReaderImpl.SwitchEncoding(System.Text.Encoding newEncoding) Unknown
System.Xml.dll!System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(bool isTextDecl) Unknown
System.Xml.dll!System.Xml.XmlTextReaderImpl.Read() Unknown
System.Xml.dll!System.Xml.XmlLoader.Load(System.Xml.XmlDocument doc, System.Xml.XmlReader reader, bool preserveWhitespace) Unknown
System.Xml.dll!System.Xml.XmlDocument.Load(System.Xml.XmlReader reader) Unknown
System.Xml.dll!System.Xml.XmlDocument.Load(System.IO.Stream inStream) Unknown
Spire.Pdf.dll!spr.ᜀ() Unknown
Spire.Pdf.dll!spr.spr(sprᣃ A_0, sprប A_1) Unknown
Spire.Pdf.dll!sprᣃ.ᜁ() Unknown
Spire.Pdf.dll!sprᣃ.ᜀ(System.IO.Stream A_0, bool A_1) Unknown
Spire.Pdf.dll!Spire.Pdf.PdfDocument.PdfDocument(string filename) Unknown
Billennium.Spire.dll!Billennium.Spire.SpirePdfFactory.Create(string filePath) Line 48 C#
So it work without debuging correct.
When we try to open those pdf with simple console app it work good without throwing internal exceptions at all.
So it seams that:
1. On Azure application will crash
2. On local IIS it work but internal exception is throw and catch.
3. On console app it work good.
May be 1 and 2 situations wasn't caused by the same problem ?
Please help, how we can fix it?
Best regards
Dariusz Arendarski
P.S. We have done test on version 4.8 ...problem still exist, but when we generate again document (using PdfDocument.MergeFiles(streams) 4.
So it seem that problem is in PdfDocument.MergeFiles