Aspose.PDF Drawing.Rectangle.Text.HorizontalAlignment をLeftにしても中央に配置される

長方形の中に、左寄せで文字を表示させたいのですが、下記ソースコードのように記述したところ、添付CannotHorizontalAlignmentLeft.pdf (95.4 KB)
のように長方形の中央に文字列が配置されます。
ご確認、および、他に対応方法があればを教えて頂けないでしょうか?

■使用バージョン
Aspose.Pdf for .NET 18.10.0.0

■ソースコード(VB.Net)
'Instantiate the License class
Dim license As License = New License()
'Pass only the name of the license file embedded in the assembly
license.SetLicense(“Aspose.Pdf.lic”)

    Dim doc As Document = New Document(sourcePath)

    ' Create Graph object with certain dimensions
    Dim graph As Drawing.Graph = New Drawing.Graph(doc.PageInfo.Width, doc.PageInfo.Height)
    ' Add graph object to paragraphs collection of Page instance
    doc.Pages(1).Paragraphs.Add(graph)

    Dim textColor As Color = Color.FromArgb(255, 255, 255)
    Dim backColor As Color = Color.FromArgb(255, 0, 128)

    ' Rectangle
    Dim backRectangle As Drawing.Rectangle = New Drawing.Rectangle(225, 208, 125, 10)
    backRectangle.GraphInfo.Color = backColor
    backRectangle.GraphInfo.FillColor = backColor

    ' add Text
    Dim fragment1 As Text.TextFragment = New Text.TextFragment("Left")
    fragment1.TextState.Font = Text.FontRepository.FindFont("MS Gothic")
    fragment1.TextState.FontSize = 10
    fragment1.TextState.ForegroundColor = textColor
    backRectangle.Text = fragment1
    backRectangle.Text.HorizontalAlignment = HorizontalAlignment.Left

    graph.Shapes.Add(backRectangle)

    doc.Save(outputPdfPath)

@shogo_kawano_bridgestone_com

サポートにお問い合わせいただきありがとうございます。

ご使用の環境でAspose.PDF for .NET 18.11を使用して以下のコードスニペットを試してみてください。

Document doc = new Document();
Aspose.Pdf.Page page = doc.Pages.Add();
page.PageInfo.Margin = new MarginInfo(0, 0, 0, 0);
const double width = 300;
const double height = 300;
var box = new FloatingBox((float)width, (float)height)
{
    Left = 100f,
    Top = 50f,
    Margin = new MarginInfo(0, 0, 0, 0),
    Border = new BorderInfo(BorderSide.None),
    HorizontalAlignment = HorizontalAlignment.Left,
    BackgroundColor = Aspose.Pdf.Color.FromArgb(255, 0, 128)
};
TextFragment fragment = new TextFragment("Sample Text added in FloatingBox");
fragment.HorizontalAlignment = HorizontalAlignment.Left;
box.Paragraphs.Add(fragment);
page.Paragraphs.Add(box);
doc.Save(outputPdfPath);

これが参考になることを願っています。 さらなる支援が必要な場合は、お気軽にお問い合わせください。