Doing a TextFragment Rotation in a Cell cant get the contents to align horizontally or vertically

Hello,

I can’t seem to figure out text rotation and the alignment of the content within a cell. I have tried all permutation of Vertical and Horizontal alignment and I cant get the text centered when rotated 90.

Testing further we are also experiencing issues with other rotation angle and alignments. There are even cases where the content is not displayed or shown outside the intended cell. Rotation 0 works but the others do not.
Below is an example:
AsposePDFRotation.pdf (7.9 KB)

    static void Main(string[] args)
    {
        Aspose.Pdf.License license = new Aspose.Pdf.License()
        {
            Embedded = true
        };
        license.SetLicense("Aspose.Pdf.lic");
        var pdf = new Document();           

        var rotations = new double[] {
            0, //ok
            45, //?
            90, //??? (barf)
            //135, //no real world use
            //180, //no real world use
        };

        foreach (double r in rotations)
        {
            var page = pdf.Pages.Add();
            page.Paragraphs.Add(new TextFragment($"Rotation:{r}"));
            var table = new Table();
            table.ColumnWidths = COL(Enum.GetNames(typeof(HorizontalAlignment)).Length);
            foreach (HorizontalAlignment h in Enum.GetValues(typeof(HorizontalAlignment)))
            {
                var row = table.Rows.Add();
                row.MinRowHeight = (PageSize.PageLetter.Height-50) / Enum.GetNames(typeof(HorizontalAlignment)).Length;
                foreach (VerticalAlignment v in Enum.GetValues(typeof(VerticalAlignment)))
                {
                    var tf = new TextFragment($"H: {(h.ToString())} ({(int)h}), V:{v.ToString()}  ({(int)v})");
                    tf.TextState.Rotation = r;
                    var cell = row.Cells.Add();                      
                    cell.VerticalAlignment = v;
                    cell.DefaultCellTextState.HorizontalAlignment = h;
                    cell.Border = new BorderInfo(BorderSide.All, 1, Color.Black);
                    cell.Paragraphs.Add(tf);
                }
            }
            page.Paragraphs.Add(table);
        }

        pdf.Save("C:/temp/AsposePDFRotation.pdf");

    }

    public static string COL(int columns)
    {
        var sb = new StringBuilder();
        var s = ((PageSize.PageLetter.Width-50) / columns).ToString();

        for (int i = 1; i <= columns; i++)
        {
            sb.Append(s);
            sb.Append(" ");
        }

        return sb.ToString().TrimEnd();
    }

@DenisW,

We managed to replicate the problem of text alignments in our environment. An enhancement ticket ID PDFNET-44876 has been logged under the ticket ID PDFNET-44876 in our issue tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.