I’m trying to insert an image which I got as an byte array into a newly created document with the following code snippet:
Document additionalDoc = new Document(); DocumentBuilder builder = new DocumentBuilder(additionalDoc); builder.MoveToDocumentStart(); builder.InsertImage([Byte Array]);
This woks fine for most cases, but I encountered a PNG while testing which causes the following exception:
Could not create the bitmap with the specified parameters. Possible lack of system resources.: Parameter is not valid. FileFormat=Unknown at ..ctor(Byte , SKRectI ) at ..ctor(Byte ) at . (Byte ) at . (Byte ) at . (Byte ) at Aspose.Words.DocumentBuilder.InsertImage(Byte imageBytes, RelativeHorizontalPosition horzPos, Double left, RelativeVerticalPosition vertPos, Double top, Double width, Double height, WrapType wrapType) at Aspose.Words.DocumentBuilder.InsertImage(Byte imageBytes) ...
I don’t know what is so special with that picture (testImage.zip (11.6 KB))
This happens with the version of Aspose.Words v20.9.0.