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
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);
}
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> </td><td> </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);
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.