Free Support Forum - aspose.com

Padding bug

Padding isn't working correctly on table cells. In the attached PDF you can see that the 1st and 3rd cells in the table heading are not properly padded. I downloaded and installed the 3.9.0.0 release to see if that would fix it and it didn't. I could swear I had this problem before and it had been fixed in a hot fix.

Dim license As Aspose.Pdf.License = New Aspose.Pdf.License

license.SetLicense("Aspose.Custom.lic")

Dim FontName As String = "Verdana"

Dim FontSize As Integer = 10

Dim PointsPerInch As Integer = 72

Dim ThisPdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf

ThisPdf.PageSetup.Margin.Top = 36

ThisPdf.PageSetup.Margin.Right = 36

ThisPdf.PageSetup.Margin.Bottom = 36

ThisPdf.PageSetup.Margin.Left = 36

ThisPdf.IsLandscape = False

ThisPdf.PageSetup.PageHeight = 11 * PointsPerInch

ThisPdf.PageSetup.PageWidth = 8.5 * PointsPerInch

ThisPdf.TextInfo.FontName = FontName

ThisPdf.TextInfo.FontSize = FontSize

ThisPdf.PageNumberFormat = Aspose.Pdf.PageNumberFormatType.Arab

Dim DefaultTI As Aspose.Pdf.TextInfo = New Aspose.Pdf.TextInfo

DefaultTI.FontName = FontName

DefaultTI.FontSize = FontSize

DefaultTI.Alignment = Aspose.Pdf.AlignmentType.Left

Dim Section1 As Aspose.Pdf.Section = ThisPdf.Sections.Add

Section1.TextInfo.FontName = FontName

Section1.TextInfo.FontSize = FontSize

Dim BorderColor As New Aspose.Pdf.Color(204, 204, 204)

Dim TableHeadingTI As New Aspose.Pdf.TextInfo

TableHeadingTI.FontName = FontName

TableHeadingTI.FontSize = FontSize

TableHeadingTI.Color = New Aspose.Pdf.Color(255, 255, 255)

TableHeadingTI.IsTrueTypeFontBold = True

Dim TableHeadingMI As New Aspose.Pdf.MarginInfo

TableHeadingMI.Top = 16

TableHeadingMI.Right = TableHeadingMI.Top

TableHeadingMI.Bottom = TableHeadingMI.Top

TableHeadingMI.Left = TableHeadingMI.Top

Dim TableHeadingBI As New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.Left, 1, BorderColor)

Dim TableFooterTI As New Aspose.Pdf.TextInfo

TableFooterTI.FontName = FontName

TableFooterTI.FontSize = FontSize

TableFooterTI.Color = New Aspose.Pdf.Color(0, 0, 0)

TableFooterTI.IsTrueTypeFontBold = True

Dim TableFooterMI As New Aspose.Pdf.MarginInfo

TableFooterMI.Top = 16

TableFooterMI.Right = TableFooterMI.Top

TableFooterMI.Bottom = TableFooterMI.Top

TableFooterMI.Left = TableFooterMI.Top

Dim TableFooterBI As New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.Left, 1, BorderColor)

Dim TableRowTI As New Aspose.Pdf.TextInfo

TableRowTI.FontName = FontName

TableRowTI.FontSize = FontSize

Dim TableRowMI As New Aspose.Pdf.MarginInfo

TableRowMI.Top = 16

TableRowMI.Right = TableRowMI.Top

TableRowMI.Bottom = TableRowMI.Top

TableRowMI.Left = TableRowMI.Top

Dim TableRowBI As New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1, BorderColor)

Dim Table1 As Aspose.Pdf.Table = New Aspose.Pdf.Table(Section1)

Section1.Paragraphs.Add(Table1)

Table1.DefaultCellTextInfo = DefaultTI

Table1.ColumnWidths = "72 324 72 72"

Dim TableR1 As Aspose.Pdf.Row = Table1.Rows.Add

TableR1.BackgroundColor = New Aspose.Pdf.Color(0, 0, 0)

TableR1.DefaultCellBorder = TableHeadingBI

Dim TableR1C1 As Aspose.Pdf.Cell = TableR1.Cells.Add("Quantity")

TableR1C1.Alignment = Aspose.Pdf.AlignmentType.Center

TableR1C1.DefaultCellTextInfo = TableHeadingTI

TableR1C1.Padding = TableHeadingMI

Dim TableR1C2 As Aspose.Pdf.Cell = TableR1.Cells.Add("Description")

TableR1C2.Alignment = Aspose.Pdf.AlignmentType.Center

TableR1C2.DefaultCellTextInfo = TableHeadingTI

TableR1C2.Padding = TableHeadingMI

Dim TableR1C3 As Aspose.Pdf.Cell = TableR1.Cells.Add("Unit Price")

TableR1C3.Alignment = Aspose.Pdf.AlignmentType.Center

TableR1C3.DefaultCellTextInfo = TableHeadingTI

TableR1C3.Padding = TableHeadingMI

Dim TableR1C4 As Aspose.Pdf.Cell = TableR1.Cells.Add("Amount")

TableR1C4.Alignment = Aspose.Pdf.AlignmentType.Center

TableR1C4.DefaultCellTextInfo = TableHeadingTI

TableR1C4.Padding = TableHeadingMI

Dim TableR2 As Aspose.Pdf.Row = Table1.Rows.Add

Dim TableR2C1 As Aspose.Pdf.Cell = TableR2.Cells.Add("3")

TableR2C1.Alignment = Aspose.Pdf.AlignmentType.Center

TableR2C1.DefaultCellTextInfo = TableRowTI

TableR2C1.Padding = TableRowMI

TableR2C1.Border = TableRowBI

Dim TableR2C2 As Aspose.Pdf.Cell = TableR2.Cells.Add("Some item")

TableR2C2.Alignment = Aspose.Pdf.AlignmentType.Left

TableR2C2.DefaultCellTextInfo = TableRowTI

TableR2C2.Padding = TableRowMI

TableR2C2.Border = TableRowBI

Dim TableR2C3 As Aspose.Pdf.Cell = TableR2.Cells.Add("$0.25")

TableR2C3.Alignment = Aspose.Pdf.AlignmentType.Right

TableR2C3.DefaultCellTextInfo = TableRowTI

TableR2C3.Padding = TableRowMI

TableR2C3.Border = TableRowBI

Dim TableR2C4 As Aspose.Pdf.Cell = TableR2.Cells.Add("$0.75")

TableR2C4.Alignment = Aspose.Pdf.AlignmentType.Right

TableR2C4.DefaultCellTextInfo = TableRowTI

TableR2C4.Padding = TableRowMI

TableR2C4.Border = TableRowBI

Dim TableR3 As Aspose.Pdf.Row = Table1.Rows.Add

TableR3.BackgroundColor = New Aspose.Pdf.Color(204, 204, 204)

TableR3.DefaultCellBorder = TableFooterBI

Dim TableR3C1 As Aspose.Pdf.Cell = TableR3.Cells.Add("Sub-total")

TableR3C1.ColumnsSpan = 3

TableR3C1.Alignment = Aspose.Pdf.AlignmentType.Right

TableR3C1.DefaultCellTextInfo = TableFooterTI

TableR3C1.Padding = TableFooterMI

Dim TableR3C4 As Aspose.Pdf.Cell = TableR3.Cells.Add("$0.75")

TableR3C4.Alignment = Aspose.Pdf.AlignmentType.Right

TableR3C4.DefaultCellTextInfo = TableFooterTI

TableR3C4.Padding = TableFooterMI

ThisPdf.Save("test.pdf", Aspose.Pdf.SaveType.OpenInBrowser, System.Web.HttpContext.Current.Response)

-David

Hello David,

I have tested the issue and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFNET-7128. We will investigate this issue in detail and will keep you updated on the status of a correction. We apologize for your inconvenience.

Has this been fixed yet?

Hello David,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Our development team is working hard to get this issues resolved. Meanwhile I’ve also contacted the team to share the ETA for the resolution of this problem.

Your patience is highly appreciated in this regard and soon you will be updated with the required information.

Hello David,

Thanks for your patience.

I'm pleased to inform you that the issue reported earlier as PDFNET-7128 is resolved in the latest hotfix for Aspose.Pdf for .NET 4.1.1. You may download the hotfix from this link. I've also attached the resultant PDF. Please take a look.

In case you still face any problem or you've any further query, please feel free to contact.