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

Free Support Forum - aspose.com

Error with border on table row with IsFirstRowRepeated = true

When creating a pdf (using generator) where a table has a border on the first row (cell or row) that is repeated (via IsFirstRowRepeated), the Bottom border is not printed the first time but is on following pages.

The following C# snippet shows this behavior

var pdf = new Aspose.Pdf.Generator.Pdf();
var sect = pdf.Sections.Add();
sect.PageInfo.PageWidth = PageSize.A4Width;
sect.PageInfo.PageHeight = PageSize.A4Height;

var tbl=new Table() {IsFirstRowRepeated = true};

var row1 = tbl.Rows.Add();
row1.Border=new BorderInfo(15,1); // All sides 1pt
row1.Cells.Add().Paragraphs.Add(new Text("The header row"));
for (int i = 0;(i < 200); i++)
tbl.Rows.Add().Cells.Add().Paragraphs.Add(new Text($"Line no {i}"));

pdf.Save( Environment.ExpandEnvironmentVariables(@"C:\Users\%username%\Desktop\Sample.pdf"));

Am I doing something wrong or is there a bug in Aspose.Pdf ?

Hi JohnLeo,

Thanks for contacting support.

I have tested the scenario using following code snippet based on new Document Object Model with Aspose.Pdf for .NET 10.7.0 and I am unable to notice any issue. The border for repeating rows is properly being displayed. We recommend you to please try using new DOM instead of legacy Aspose.Pdf.Generator which is an older approach.

For your reference, I have also attached the resultant file generated over my end. Please take a look.


var pdf = new Aspose.Pdf.Document();<o:p></o:p>

var sect = pdf.Pages.Add();

sect.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;

sect.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;

var tbl=new Aspose.Pdf.Table() { RepeatingRowsCount=1};


var row1 = tbl.Rows.Add();

row1.Border=new Aspose.Pdf.BorderInfo( Aspose.Pdf.BorderSide.All, 1); // All sides 1pt

row1.Cells.Add().Paragraphs.Add(new TextFragment("The header row"));

for (int i = 0;(i < 200); i++)

tbl.Rows.Add().Cells.Add().Paragraphs.Add(new TextFragment("Line no {i}"));

pdf.Save( (@“c:/pdftest/RepeatingRow_Test.pdf”));

Thanks for the feedback. Disappointing that I must re-write so much code. Perhaps noobs like me should have a clearer warning against using Pdf.Generator

Hi JohnLeo,

We are truly sorry for the inconvenience caused. Sure we will consider your suggestion after discussing internally and will add some notification tags in Old generator documentation for the purpose.

Please feel free to contact us for any further assistance.

Best Regards,