Free Support Forum - aspose.com

Apsoe.PDF is failing in Open Shift ECS (Linux) when saving to a memory stream

We are using Apsoe.PDF version 19.12 in an application that in hosted in Open Shift (ECS) in a Linux operating system. Aspose.PDF is failing when trying to save a memory stream in the Save method.
The error message is in the link below

Aspose_Error.pdf (126.8 KB)

Below is the code snippet:

public Task ConvertHtmlAsync(string html, DocumentLayout layout)
{
// Set license
License license = new License();
license.SetLicense(“Aspose.Total.lic”);

        // Set margins. This value is in points but other units like
        // Inches and centimeters can also be used as 12inch or 12cm
        var margin = new MarginInfo
        {
            Top = layout.Margin.Top,
            Bottom = layout.Margin.Bottom,
            Left = layout.Margin.Left,
            Right = layout.Margin.Right
        };

        // Instantiate an object PDF class
        var pdf = new Document();
        var fragment = new HtmlFragment(html);

        var page = pdf.Pages.Add();
        page.PageInfo.Margin = margin;
        page.PageInfo.IsLandscape = layout.Orientation == DocumentOrientation.Landscape;
        page.Paragraphs.Add(fragment);

        MemoryStream stream = new MemoryStream();
        pdf.Save(stream);

        return Task.FromResult(stream);
    }

Thanks for your support!

@mwomack,

Thank you for contacting support.

I like to inform that sample code shared by you contain some undefined variables. Would you please share SSCCE code that you are using for this , so that we may try to reproduce and investigate it in our environment. Also please try to use Aspose.PDF latest version 20.1 on your end before sharing requested information with us.

We are getting the same error when using he latest version of Aspose.PDf (ver 20.1 ). Below is sample code with all of the variables defined.

Code Snippet:

var html = "<html><body><table><colgroup><col /><col /></colgroup><thead><tr><th><strong></strong></th><th><strong></strong></th></tr></thead><tbody><tr><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table></body></html>";

License license = new License();
license.SetLicense(“Aspose.Total.lic”);

var margin = new MarginInfo
{
Top = 24,
Bottom = 24,
Left = 24,
Right = 24
};

var pdf = new Document();
var fragment = new HtmlFragment(html);

var page = pdf.Pages.Add();
page.PageInfo.Margin = margin;
page.PageInfo.IsLandscape = true;
page.Paragraphs.Add(fragment);

MemoryStream stream = new MemoryStream();
pdf.Save(stream);(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

@mwomack,

Thanks for sharing the details.

I have tested the scenario and and I have logged investigation ticket with ID as PDFJAVA-36883 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

Support Team,

Please keep mind that we are using .Net Core (Not Java) in a Linux environment.

Thanks!

@mwomack,

Thanks for sharing information with us. We have mentioned this in our issue tracking system.