I have a svg file, that i am converting to dxf file.
However, the converted file has an additional boundry that the svg doesnot. How can i remove that from the output file.
Could you please provide more information about which Aspose product you are using for the conversion and the specific settings or code you are currently applying? This will help us provide a more accurate answer.
I am using Aspose.Imaging
@AsmitaAgrawal To better assist you, we’d appreciate if you could provide:
- The sample image you’re working with
- The specific code you’re using for the conversion
This information will help us replicate the issue and provide a more accurate solution. We’re committed to resolving your concern as quickly as possible.
Looking forward to your response.
@Alexey.Karpenko
Aspose Test.7z (92.7 KB)
Attached is svg file and converted dxf file.
Code used –
File.WriteAllText(Path.Combine(templatesFolder, infilename), svgdata);
// Load the svg file in an instance of Image
using (var image = Aspose.Imaging.Image.Load(Path.Combine(templatesFolder, infilename)))
{
//image.Resize(image.Width * 12, image.Height * 12);
image.BackgroundColor = Aspose.Imaging.Color.White;
// Create an instance of DxfOptions
var exportOptions = new Aspose.Imaging.ImageOptions.DxfOptions() { TextAsLines = false, ConvertTextBeziers = true };
Aspose.Imaging.ImageOptions.VectorRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
rasterizationOptions.PageSize = new SizeF(image.Width* 5, image.Height* 5);
//rasterizationOptions.PageWidth = image.Width;
//rasterizationOptions.PageHeight = image.Height;
rasterizationOptions.CenterDrawing = true;
exportOptions.VectorRasterizationOptions = rasterizationOptions;
// Save svg to dxf
image.Save(Path.Combine(templatesFolder, outfilename), exportOptions);
}
@AsmitaAgrawal Thank you for providing the details. We appreciate your patience and will notify you as soon as this issue is resolved. If you have any further questions in the meantime, please don’t hesitate to reach out.
@AsmitaAgrawal
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): IMAGINGNET-7331
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Hello, @AsmitaAgrawal
To export an SVG image to the DXF format without a frame, please add the following parameter to the SvgRasterizationOptions initialization:
BackgroundColor = Color.Transparent
Here’s an example of a code snippet that demonstrates this operation:
using (Image image = Image.Load(inputFilePath))
{
var exportOptions = new DxfOptions()
{
TextAsLines = true,
ConvertTextBeziers = true,
FullFrame = true,
VectorRasterizationOptions = new SvgRasterizationOptions()
{
PageWidth = (float)image.Width,
PageHeight = (float)image.Height,
FullFrame = true,
Positioning = PositioningTypes.DefinedByDocument,
CenterDrawing = true,
BackgroundColor = Color.Transparent
}
};
// Save svg to dxf
image.Save(outputFilePath, exportOptions);
}