We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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 System.Text;
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

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 = Directory.GetCurrentDirectory() + “/image.png”;
img.FixHeight = 10.0;
img.FixWidth = 10.0;

firstCell.Alignment = HorizontalAlignment.Right;//set the alignment of the cell

//create second cell in first row, with text
var secondCell = firstRow.Cells.Add();

var secondCellText = new TextFragment();
secondCellText.Text = “Right Aligned”;

secondCell.Alignment = HorizontalAlignment.Right;



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,