I am running a .NET Core Web API in a Linux Docker container and receive this error: “Requested 1030124 bytes. Maximum size for region is 262144 bytes.” when trying to call .Save() on a CADImage.
This only happens in the Linux container but works fine when running normally through Visual Studio in Windows.
Here is the code saving the image:
private readonly CadImage _img;
var rasterizationOptions = new Aspose.CAD.ImageOptions.PngOptions()
{
VectorRasterizationOptions = new CadRasterizationOptions()
{
PageHeight = newSize,
PageWidth = newSize,
Zoom = 1.0f,
DrawType = CadDrawTypeMode.UseObjectColor,
Layouts = new string[] { SelectedLayout },
GraphicsOptions = new GraphicsOptions()
{
TextRenderingHint = TextRenderingHint.AntiAlias,
},
ExportAllLayoutContent = false,
},
};
var stream = new MemoryStream();
_img.Save(stream, rasterizationOptions);
When changing the PageHeight and PageWidth options to smaller numbers (this errors out when PageHeight and PageWidth are 16000) the error goes away.
Please let me know of any information you may need from me to get this issue resolved.