-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Image cause an System.NullReferenceException #16
Comments
Did you set ImageSource.ImageSourceImpl?
…On Jan 30, 2018 1:49 PM, "Markus Kaufmann" ***@***.***> wrote:
When ever I try to add a Image my program always crash.
There is no difference if I use ImageSource or XImage and also if I use
FromBinary,FromFile or FromStream. Everytime I get (nearly) the same
Exception.
Object reference not set to an instance of an object.
In case of using ImageSource.FromBinary the next line is:
at MigraDocCore.DocumentObjectModel.MigraDoc.DocumentObjectModel.Shapes.ImageSource.FromBinary(String
name, Func1 imageSource, Nullable1 quality)
Before opening the file I check if the file is existing with
System.IO.File.Exists;
Im using .Net Core 2.0, with Visual Studio Community on Mac OS.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#16>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOoWRkRJOA9-cX32EVv36KcZUJ7SpwxWks5tPw_GgaJpZM4RyRoZ>
.
|
Yes I did. |
That is not what i ment,
https://github.com/groege/PdfSharpCore/blob/a429b03519d4290096118642ebf5e536652aba74/PdfSharpCore.Test.Uwp/ImageSourceUnitTest.cs
Take a look at the TestSetup Method.
…On Tue, Feb 6, 2018 at 10:27 AM, Markus Kaufmann ***@***.***> wrote:
Yes I did.
using(FileStream fs = info.OpenRead()) { fs.Read(bytesOfImg,0,(int)info.Length);
} IImageSource imgSource = ImageSource.FromBinary(info.
Name,()=>bytesOfImg);
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#16 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOoWRstCginNBLSQZxb_8oTM7fa33Heaks5tSBsXgaJpZM4RyRoZ>
.
|
Depending on the Platform you'll have to set a proper Implementation
On Tue, Feb 6, 2018 at 10:54 AM, Hans-Georg Haberl <haberl.george@gmail.com>
wrote:
… That is not what i ment,
https://github.com/groege/PdfSharpCore/blob/a429b03519d4290096118642ebf5e5
36652aba74/PdfSharpCore.Test.Uwp/ImageSourceUnitTest.cs
Take a look at the TestSetup Method.
On Tue, Feb 6, 2018 at 10:27 AM, Markus Kaufmann ***@***.***
> wrote:
> Yes I did.
> using(FileStream fs = info.OpenRead()) { fs.Read(bytesOfImg,0,(int)info.Length);
> } IImageSource imgSource = ImageSource.FromBinary(info.Na
> me,()=>bytesOfImg);
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#16 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AOoWRstCginNBLSQZxb_8oTM7fa33Heaks5tSBsXgaJpZM4RyRoZ>
> .
>
|
By extending ImageSource you could also implement it on your own...
On Tue, Feb 6, 2018 at 10:54 AM, Hans-Georg Haberl <haberl.george@gmail.com>
wrote:
… Depending on the Platform you'll have to set a proper Implementation
On Tue, Feb 6, 2018 at 10:54 AM, Hans-Georg Haberl <
***@***.***> wrote:
> That is not what i ment,
>
> https://github.com/groege/PdfSharpCore/blob/a429b03519d42900
> 96118642ebf5e536652aba74/PdfSharpCore.Test.Uwp/ImageSourceUnitTest.cs
> Take a look at the TestSetup Method.
>
> On Tue, Feb 6, 2018 at 10:27 AM, Markus Kaufmann <
> ***@***.***> wrote:
>
>> Yes I did.
>> using(FileStream fs = info.OpenRead()) { fs.Read(bytesOfImg,0,(int)info.Length);
>> } IImageSource imgSource = ImageSource.FromBinary(info.Na
>> me,()=>bytesOfImg);
>>
>> —
>> You are receiving this because you commented.
>> Reply to this email directly, view it on GitHub
>> <#16 (comment)>,
>> or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/AOoWRstCginNBLSQZxb_8oTM7fa33Heaks5tSBsXgaJpZM4RyRoZ>
>> .
>>
>
>
|
Do you have implementations of ImageSourceImpl for each platform? Or is it up to us? Default System.NullReferenceException is a bit confusing. Notes on setting font source impl are there but no documentation for image source impl. |
Yeah, didn't get to update the doc...
I'm doing this project just on the side for my job... (put it on github in
the hopes others will chime in though I don't really have any more time for
it since I'm swamped with deadlines...)
What platforms do you need? If it's Android, there is an Android project,
another one for UWP, IOS ist not implemented...
Or you could use ImageSharp (which was not performant enough at the time of
implementation) which will work on all plaforms since it's implemented in
c#... Though I'd write a new implementation for this as well since
ImageSharp was still in alpha when I implemented it, as far as I understand
they did some major changes an enhancements (maybe the performance is now
better as well?)
br
…On Fri, Feb 9, 2018 at 5:40 PM, Greg Taylor ***@***.***> wrote:
Do you have implementations of ImageSourceImpl for each platform? Or is it
up to us?
Default System.NullReferenceException is a bit confusing. Notes on setting
font source impl are there but no documentation for image source impl.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#16 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOoWRrcJqPRykZ0ft6aFaugMKlz4L5MJks5tTHUDgaJpZM4RyRoZ>
.
|
So anyone please feel free to chime in!
On Fri, Feb 9, 2018 at 7:07 PM, Hans-Georg Haberl <haberl.george@gmail.com>
wrote:
… Yeah, didn't get to update the doc...
I'm doing this project just on the side for my job... (put it on github in
the hopes others will chime in though I don't really have any more time for
it since I'm swamped with deadlines...)
What platforms do you need? If it's Android, there is an Android project,
another one for UWP, IOS ist not implemented...
Or you could use ImageSharp (which was not performant enough at the time
of implementation) which will work on all plaforms since it's implemented
in c#... Though I'd write a new implementation for this as well since
ImageSharp was still in alpha when I implemented it, as far as I understand
they did some major changes an enhancements (maybe the performance is now
better as well?)
br
On Fri, Feb 9, 2018 at 5:40 PM, Greg Taylor ***@***.***>
wrote:
> Do you have implementations of ImageSourceImpl for each platform? Or is
> it up to us?
>
> Default System.NullReferenceException is a bit confusing. Notes on
> setting font source impl are there but no documentation for image source
> impl.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#16 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AOoWRrcJqPRykZ0ft6aFaugMKlz4L5MJks5tTHUDgaJpZM4RyRoZ>
> .
>
|
I just found this implementation in the repository, which works for my platform (.net core 2.0) PdfSharpCore/PdfSharpCore.ImageSharp/ImageSharpImageSource.cs |
I'm using the latest ImageSharp library but I think it's still a bit buggy. Doesn't handle transparency very well when importing from png format. |
Ok ty,
So seems like to need to implement the missing platforms you want to use.
Would you be so kind and send a pull request for the platforms, so others
will be able to use them?
…On Fri, Feb 9, 2018 at 7:14 PM, Greg Taylor ***@***.***> wrote:
I'm using the latest ImageSharp library but I think it's still a bit
buggy. Doesn't handle transparency very well when importing from png format.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#16 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOoWRme_C40JmC6YDDwHmlhBgnHFHWr0ks5tTIr7gaJpZM4RyRoZ>
.
|
Hi, I am trying to do this on a .net core web app, how do I set the ImageSourceImpl so I can set ImageSource.FromFile? |
When ever I try to add a Image my program always crash.
There is no difference if I use ImageSource or XImage and also if I use FromBinary,FromFile or FromStream. Everytime I get (nearly) the same Exception.
Object reference not set to an instance of an object.
In case of using ImageSource.FromBinary the next line is:
Before opening the file I check if the file is existing with System.IO.File.Exists;
Im using .Net Core 2.0, with Visual Studio Community on Mac OS.
The text was updated successfully, but these errors were encountered: