Image alignment doesn't work

We are trying to align an image in a table with halign=“right” but it doesn’t get applied.

This is the reproducer code

using System;
using System.IO;
using Aspose.Pdf;
using Aspose.Pdf.Generator;
using Aspose.Pdf.Text;
using Cell = Aspose.Pdf.Cell;
using Image = Aspose.Pdf.Image;
using Table = Aspose.Pdf.Table;

namespace Aspose
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // Reproducer for issue: https://gitlab.factset.com/dexter/dexter/issues/105
            var doc = new Document(); // create document
            var page = doc.Pages.Add(); // add a page to the document’s collection of pages
            var mytable = new Table(); // Instantiate a table object
            mytable.ColumnWidths = "80% 20%"; // Set with column widths of the table
            page.Paragraphs.Add(mytable); // Add the table in paragraphs collection of the desired section

            var firstRow = mytable.Rows.Add(); // Add a row to the table’s collection of rows
            var firstCell = firstRow.Cells.Add(); // Add a cell to the row’s collection of cells

            // create image, read from file, set properties
            var img = new Image();
            img.File = Path.Combine(Directory.GetCurrentDirectory(), "image.png");
            img.FixHeight = 10.0;
            img.FixWidth = 10.0;
            firstCell.Alignment = HorizontalAlignment.Right; // set the alignment of the cell
            firstCell.Paragraphs.Add(img);

            // create the second cell in the first row with text
            var secondCell = firstRow.Cells.Add();
            var secondCellText = new TextFragment();
            secondCellText.Text = "Right Aligned";
            secondCell.Alignment = HorizontalAlignment.Right;
            secondCell.Paragraphs.Add(secondCellText);

            doc.Save("ImageNotAligned.pdf");
        }
    }
}

Hello Daniel,


Thanks for using our API’s.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}

I have tested the scenario and have managed to reproduce the problem that image alignment is not working. I have logged it as PDFNET-42197 in our issue tracking system for further investigation.


We are sorry for this inconvenience.


Best Regards,

I tested with the latest version 23.3.1, but the issue still persists. Can I get an update on it?

@dfactset

We regret to inform you that the issue has not been yet resolved due to other pending issues in the queue. We have recorded your concerns and will surely inform you once we make some progress towards its fix. Please be patient and spare us some time.

We are sorry for the inconvenience.