Hi,
I'm trying to include an image from a SQL database into a pdf file with the following code (C# MVC):
Code:
private PdfDocument openImageFromByteArray(byte[] ImageStream)
{
MemoryStream stream = new MemoryStream(ImageStream);
PdfDocument OutputDocument = new PdfDocument();
OutputDocument.Pages.Add(new PdfPage());
XGraphics xgr = XGraphics.FromPdfPage(OutputDocument.Pages[0]);
XImage img = XImage.FromStream(stream);
xgr.DrawImage(img, 0, 0);
return OutputDocument;
}
if I save OutputDocument locally it works fine, but as soon as the code runs from the server I get the error that the image was not decoded properly.
Using PdfSharp version 1.50.5147
Thanks