We are in the process of testing few scenarios before we proceed with aspose.cad licensing. I’m trying to convert a DXF file to a PNG but i can’t figure out how to get rid of the additional white space that get added around the output image(below)
output_with_margin.png (717.1 KB)
The only way i manage to get rid of the extra space in above image is by adding hardcoded Margins in CadRasteriztionOptions and i dont want to do that, i just want image to be as per specified page width and height(which is happening) but docked to bottom left corner:
my code
class Program
{
static void Main(string[] args)
{
using (var image = Aspose.CAD.Image.Load("C:\\Work\\CBA\\The Foundry_02.dxf"))
{
// create an instance of CadRasterizationOptions and set page height & width
var rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions()
{
PageWidth = 11968,
PageHeight = 4994,
AutomaticLayoutsScaling = true,
NoScaling = false,
//Margins = new Margins
//{
// Top = 0,
// Right = -3000,
// Bottom = -2570,
// Left = -3080
//},
};
var options = new Aspose.CAD.ImageOptions.PngOptions();
// set the VectorRasterizationOptions property as CadRasterizationOptions
options.VectorRasterizationOptions = rasterizationOptions;
// export DXF to PNG
image.Save("output.png", options);
}
}
}
if i uncomment margins in above code then i am able to get desired output
desired_output.png (1.0 MB)