Closed willsam100 closed 6 years ago
I ran this from source, and found the the exception is from ImageSource
:line 43, ImageSourceImpl
is null.
I also can't find anywhere the value is set, or any subclasses (given ImageSource
is abstract).
Are images supported? It looks like this hasn't been implemented.
Images are supported, but currently you have to provide your own implementation of ImageSource
and IImageSource
, as in this example - ImageSource
acts as a factory for image classes, which have to provide methods to save them as BMP and JPEG.
Once you have this implementation, you pass it to PDFSharp through setting ImageSourceImpl
:
// using MigraDocCore.DocumentObjectModel.MigraDoc.DocumentObjectModel.Shapes;
ImageSource.ImageSourceImpl = new MyPortableImageSource();
thanks for the help. I have this working now.
As a possible improvement, it could be useful to put a put a try/catch in if the value is null and re-throw with a message to implement it.
feel free to close any time you want.
Just to update on this: the library now throws an exception when the ImageSource implementation is missing. :)
Description: While trying to draw an image onto the PDF, an instance of
XImage
can not be created and throws an exception.Error:
While calling `XImage.FromStream`` the following exception is thrown.
This also occurs if a file path is used.
Expected: To back an instance of
XImage
that can then be drawn onto the PDF usingXGraphics
instance.Environment: The main code is a .NETStandard 2.0 project. The runtimes i have tried included .netcore, mono, and mono-android. I would like to use this on both mono-android and mono-ios
Didstopia.PDFSharp 1.0.0-beta7 nuget package was used.
Full environment details: