Free Support Forum - aspose.com

Aspose imaging throws exception when watermarking EMF/WMF files

Hi Team,

We are getting an exception using Aspose.Imaging 21.2.0 for .NET when trying to apply watermarking on EMF and WMF files.
The exception occurs both on linux and windows platforms.

The code snippet that is being used is copied from here:

Please find an example solution attached for reproducing the issue.
WatermarkVectorImage.zip (6.6 MB)

Can you please investigate the the issue! Thanks!

Zoltan

@zpopswat

Can you please share the stack trace with us. Please also try using latest Aspose.Imaging for .NET 21.4 as well on your end.

@mudassir.fayyaz
Pls find the stak trace below:

  • for EMF
    System.ArgumentNullException: Value cannot be null. (Parameter ‘image’)
    at …ctor(RasterImage , ICollection`1 )
    at Aspose.Imaging.Graphics.( )
    at Aspose.Imaging.Graphics.( )
    at Aspose.Imaging.Graphics.(String , Font , Brush , RectangleF, StringFormat , Boolean )
    at Aspose.Imaging.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
    at Aspose.Imaging.Graphics.DrawString(String s, Font font, Brush brush, Single x, Single y, StringFormat format)
    at WatermarkVectorImage.Program.watermarkEmfImageByAspose() in Program.cs:line 55

  • for WMF
    System.ArgumentNullException: Value cannot be null. (Parameter ‘image’)
    at …ctor(RasterImage , ICollection`1 )
    at Aspose.Imaging.Graphics.( )
    at Aspose.Imaging.Graphics.( )
    at Aspose.Imaging.Graphics.(String , Font , Brush , RectangleF, StringFormat , Boolean )
    at Aspose.Imaging.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
    at Aspose.Imaging.Graphics.DrawString(String s, Font font, Brush brush, Single x, Single y, StringFormat format)
    at WatermarkVectorImage.Program.watermarkWmfImageByAspose() in Program.cs:line 91

@mudassir.fayyaz

I’ve tried with the latest Aspose.Imaging for .NET 21.4 and I receive the same exceptions

@zpopswat

I have created a ticket with ID IMAGINGNET-4474 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

1 Like