Hi
I was wondering why the alignment-baseline and the dominant-baseline attributes are ignored when converting to an image.
image.png (56.6 KB)
(left: png, middle: svg, right: pdf)
Code to recreate the problem:
using Aspose.Svg;
using Aspose.Svg.Builder;
using Aspose.Svg.Converters;
using Aspose.Svg.Saving;
var tempPath = Path.Combine(Path.GetTempPath(), "alignment_baseline_test");
using (var document = new SVGDocument())
{
var rectangle = new SVGRectElementBuilder()
.Width(100)
.Height(100)
.Fill(System.Drawing.Color.LightGray)
.Build(document);
var line = new SVGLineElementBuilder()
.Y1(50)
.Y2(50)
.X2(100)
.X1(0)
.Stroke(System.Drawing.Color.Black)
.Build(document);
var text = new SVGTextElementBuilder()
.AddContent("This is not a drill")
.Y(50)
.AlignmentBaseline(AlignmentBaseline.Central)
.Build(document);
document.RootElement.AppendChild(rectangle);
document.RootElement.AppendChild(line);
document.RootElement.AppendChild(text);
document.Save($"{tempPath}.svg");
var options = new ImageSaveOptions();
Converter.ConvertSVG(document, options, $"{tempPath}.png");
var pdfOptions = new PdfSaveOptions();
Converter.ConvertSVG(document, pdfOptions, $"{tempPath}.pdf");
}
Console.WriteLine($"SVG at {tempPath}.svg");
Console.WriteLine($"PNG at {tempPath}.png");
Console.WriteLine($"PNG at {tempPath}.pdf");