Search code examples
c#wpfimagemigradoc

Why MigraDoc gives an "image not found" with this fileless image?


I have the "image.png" fileless image included in my WPF C# project as "embedded resourse". The full name of such image is "myapplication.image.png".

I am using such image in a document generated via MigraDoc. However, the document generated contains all the contenent that I planified, but a gray square within wrote "image not found" instead of image "image.png".

In order to use "image.png" in my document via MigraDoc, I added the file "image.png" as embedded resource to my project. Therefore, I followed this sample to include this image in the document. My resulting code looks like the following:

byte[] imageStream = LoadImage("myapplication.image.png");
string imageFilename = MigraDocFilenameFromByteArray(imageStream);
Image image = para.AddImage(imageFilename);

Where "LoadImage" and "MigraDocFilenameFromByteArray" methods are coded as in the sample.

What am I missing? Would someone provide a pointer, please?


Solution

  • As suggested by @User241.007, the issue was using 1.32 and nor 1.50 or later. Hence, everything is working now that I removed 1.32 and installed 1.50 via package manager.