Image not show when using MemoryStream

Dear support team,
I’m using GemBox.Pdf dll with the license.
I want to add an image to pdf file and deploy on Linux with Docker. Code below:

using (var document = PdfDocument.Load(smbFileEdoc.Result.stream))
{
    PdfImage image;
    using (MemoryStream ms = new MemoryStream())
    {
        string pathImage = string.Format("{0}/{1}"
            , signKeyFolder
            , signImage);
        using (FileStream file = new FileStream(pathImage, FileMode.Open, FileAccess.Read))
        {
            file.CopyTo(ms);
            image = PdfImage.Load(ms);
        }
    }
    #region addimage
    double marginRight = 464, marginBottom = 5.5;
    using (var formattedText = new PdfFormattedText())
    {
        foreach (var page in document.Pages)
        {
            // add image
            var transform = page.Transform;
            transform.Invert();
            transform.Translate(page.CropBox.Width - 467, 12);
            // transform.Scale(220, 36, 0.5, 0.5);
            transform.Scale(180, 25, 0.5, 0.5);
            page.Content.DrawImage(image, transform);
            formattedText.Clear();
            // Format the watermark text.
            formattedText.FontFamily = new PdfFontFamily("Calibri");
            formattedText.FontSize = 5;
            // Set the watermark text.
            formattedText.Append(DateTime.Now.ToString("dd/MM/yyyy"));
            // Set the location of the bottom-left corner of the text.
            double x = page.CropBox.Width - marginRight - formattedText.Width, y = marginBottom;
            page.Content.DrawText(formattedText, new PdfPoint(x, y));
        }
    }
    #endregion
    // Add an invisible signature field to the PDF document.
    var signatureField = document.Form.Fields.AddSignature();
    // Initiate signing of a PDF file with the specified digital ID file and the password.                        
    signatureField.Sign(string.Format("{0}/{1}"
            , signKeyFolder
            , signKey),
            signPass);
    string[] arr = pathUnSign.Split(@"\");
    string folderPath = pathUnSign.Replace("Imported", "Signed").Replace(arr[arr.Length - 1], "");
    string tempFolderPath = String.Format("\\\\{0}\\{1}{2}", hostEdoc, folderEdoc, folderPath);
    if (!Directory.Exists(tempFolderPath))
    {
        DirectoryInfo di = Directory.CreateDirectory(tempFolderPath);
    }
    string fileName = arr[arr.Length - 1].ToString();
    using (MemoryStream ms = new MemoryStream())
    {
        document.Save(ms);
        byte[] buffer = new byte[ms.Length];
        ms.Seek(0, SeekOrigin.Begin);
        ms.Flush();
        ms.Read(buffer, 0, (int)ms.Length);
        _smbFileEdocService.CopyByteFile(pathUnSign.Replace("Imported", "Signed")
            , string.Empty, ms.ToArray(), true);
    }
}

Everything’s ok when i deploy on Window server. But when i deploy on Linux, Image not show, i just see a black Image like this:
image
I don’t know the cause and how to fix it.
Please help me how to fix it.

Hi,

I believe you’re missing the dependencies that are required for working on Linux.

Please check our Docker example:

Let me know if you need anything else.

Regards,
Mario