3

I try to save an image, which is in a byte array, in XImage. However, XImage's Core variant offers me the following methods:

  • FromImageSource (ImageSource.IImageSource imageSource)
  • FromFile (string path)
  • FromStream (Func stream)

FromFile is out of the question.

FromStream would be eligible. For this I converted my byte array into a stream:

Stream stream = new System.IO.MemoryStream (vars.SignEmployee)

But FromStream is expecting

Func<Stream>

How can I convert my stream to Func < Stream> ?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Ha Bardan
  • 125
  • 1
  • 3
  • 8
  • Related: https://stackoverflow.com/questions/3624731/what-is-func-how-and-when-is-it-used – mkl Sep 19 '19 at 12:11

1 Answers1

11
Stream.Position = 0; //Fix bug PdfSharpCore - link bellow
XImage image = XImage.FromStream (() => Stream);

https://github.com/ststeiger/PdfSharpCore/issues/39