PDF Table Width Issue

I need to have 2 Tables in my PDF that are EXACTLY the same size.

I add table 1 and set it’s column widths to this ColumnWidths = “192 192 192”
I add table 2 and set it’s column widths to this ColumnWidths = “96 96 96 96 96 96”

192 * 3 = 576
96 * 6 = 576

So I would expect the tables to be exactly the same size, but they are not.

The second table is a few pixels larger.

Any ideas how to fix this issue?

@TimothyBlue,
Thank you for your query.
Could you please share the runnable console application along with the output file generated by the code? Share an image also showing the issue and also identify your expected output for our reference. We will reproduce the issue here and provide assistance accordingly.

We are using Aspose PDF 20.6.0

I am including a sample project that reproduces this issue along with a sample PDF and an image showing it.

Thank you,
~Tim

TableWidthIssue.zip (1.8 KB)
table-width-issue.pdf (2.4 KB)
Table Width Issue.PNG (4.5 KB)

@TimothyBlue

Please try to include Borders in total width of the table by setting IsBordersIncluded Property as following:

var tab1 = new Table
{
 DefaultCellBorder = new BorderInfo(BorderSide.All, 0.1f, Color.Black),
 DefaultCellPadding = new MarginInfo(4, 4, 4, 4),
 ColumnWidths = columnWidths1,
 DefaultCellTextState = new TextState { FontSize = 7.5f },
 IsBordersIncluded = true // set this for both tables
};

table-width-issue.pdf (2.3 KB)

This seems to have fixed the issue.

Thank you.

~Tim