PDFsharp & MigraDoc Foundation

Unable to convert image from stream
Page 1 of 1

Author:  Drake [ Wed Oct 20, 2021 3:10 pm ]
Post subject:  Unable to convert image from stream


I'm trying to include an image from a SQL database into a pdf file with the following code (C# MVC):

        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 :)

Author:  TH-Soft [ Thu Oct 21, 2021 11:51 am ]
Post subject:  Re: Unable to convert image from stream

The question with more details and an answer can be found here:

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group