facebooktwittermenuarrow-up

GemBox Support Forum

ConvertToXpsDocument throws Exception

Hi there

I am using GemBox.Document to mail merge my reports and I updated to the latest version. Now I get an exception when I call ConvertToXpsDocument.

Exception:

System.NotSupportedException: ‘BitmapMetadata is not available on BitmapImage.’

I have a Picture that I mailmerged, and I set a byte[] with image data for that. Image data is a simple File.ReadAllBytes().

The final document output looks fine, but I have never noticed this exception before.

Any hints, what I could change to avoid this exception?

Thx and regards
Guenter

Hi Gunter,

Unfortunately, I was unable to reproduce this.
I tried with few images, including some BMP files.

Can you send us a small VS project that reproduces the issue so that we can investigate it?

Regards,
Mario

Hi Mario

Please note, that I have enables ALL “Common Language Runtime Exceptions”. Maybe thats the reason why you don’t get it… And even if I don’t insert a image in mail merge, i get this exception.

I cannot attach the reduced example here, where can I upload or send it?

Regards Guenter

Hi,

Does that mean that this is a handled exception?
In other words, what happens if you restore the Exception Settings to default, does the issue still occur?

Nevertheless, you can send us the project by submitting a support ticket and attaching your repro project in it.

Regards,
Mario

I’ve send you my example and a screenshot from my Exception settings. Hope you can reproduce it…

Hi,

After a quick investigation, it was concluded that this is a handled exception (it requires enabling the mentioned “Exception Settings” and disabling the “Enable Just My Code” option).

Also, the exception is thrown and handled by XpsDocumentWriter.Write method, which is a part of the .NET framework.
Anyway, this is done by design (see this relevant post), it’s an implementation decision that’s not considered to be a problem.

Last, I noticed that the exception is thrown because of the PNG image in the document’s header. I’m not sure what’s special about this exact PNG, but nevertheless, perhaps re-saving the image with some other application will change this behavior.

Regards,
Mario