3

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?

Lorenzo R.
  • 133
  • 9

2 Answers2

4

If using NuGet, please note that you have to check 'Include prerelease' in order for MigraDoc v1.50.x to show up in the list of packages. Note that this is the 'Version', not the 'Runtime Version' number (right-click your MigraDoc reference and check properties). The most recent stable release is only v1.32.x.

IdahoB
  • 738
  • 6
  • 14
2

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.

Lorenzo R.
  • 133
  • 9