IsFirstRowRepeated uses PageSetup dimensions- not Section dimensions

I’m creating a document in Aspose.Pdf.Generator (.Net) with one portrait page and then multiple landscape pages. The landscape pages contain a table that can continue over multiple pages.

The document has the following dimensions:
pdf.PageSetup.PageWidth = PageSize.A4Width;
pdf.PageSetup.PageHeight = PageSize.A4Height;

The first section uses these dimensions by default, then the second section gets:
sec2.PageInfo.PageHeight = PageSize.A4Width;
sec2.PageInfo.PageWidth = PageSize.A4Height;

Then the table in sec 2 gets table.IsFirstRowRepeated = true;
The result is that the rows move up and out of the pages, so the firstrow is not shown, and several pages dissapear as well.

Without IsFirstRowRepeated the problem does not occur.
Without the landscape for sec 2, the problem does not occur either.

Using the landscape dimensions for the entire document and portrait dimensions for the first section seems to do the trick, but in case of multiple page tables on both landscape and portrait pages, this won’t help.

Is this a bug? Or is there a better way of handling this?

Thank you.

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

Thank you for considering Aspose.Pdf.

We have found your mentioned issue after an initial test. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-30720. You will be notified regarding any update against your issue via this forum thread.

Sorry for the inconvenience caused,

Hi Hugo,

Thanks for using our products.

We are working over this query an will get back to you soon. We apologize for this inconvenience.

Hi Hugo,


Thanks for your patience.

We have further investigated the issue PDFNEWNET-30720 and we are unable to reproduce the problem with latest release of Aspose.Pdf for .NET 9.4.0 (problem seems to be fixed). Please try using the following code snippet to generate correct output. For your reference, I have also attached the resultant PDF generated over my end.

[C#]

static void PDFNEWNET_30720()<o:p></o:p>

{

string outPdf = @"F:\ExternalTestsData\30720.pdf";

Pdf pdf = new Pdf();

Aspose.Pdf.License license = new Aspose.Pdf.License();

license.SetLicense(@"F:\_Sources\Aspose_5\trunk\testdata\License\Aspose.Pdf.lic");

pdf.PageSetup.PageWidth =Aspose.Pdf.Generator.PageSize.A4Width;

pdf.PageSetup.PageHeight = Aspose.Pdf.Generator.PageSize.A4Height;

pdf.DestinationType = Aspose.Pdf.Generator.DestinationType.FitPage;

Aspose.Pdf.Generator.MarginInfo marginInfo = new Aspose.Pdf.Generator.MarginInfo();

marginInfo.Left = 70;

marginInfo.Right = 70;

marginInfo.Top = 20;

marginInfo.Bottom = 70;

pdf.PageSetup.Margin = marginInfo;

Aspose.Pdf.Generator.Section firstSec = pdf.Sections.Add(); //One portrait page

Aspose.Pdf.Generator.Section sec = pdf.Sections.Add(); //Several landscape pages

sec.PageInfo.PageHeight = Aspose.Pdf.Generator.PageSize.A4Width;

sec.PageInfo.PageWidth = Aspose.Pdf.Generator.PageSize.A4Height;

Aspose.Pdf.Generator.Text header = new Aspose.Pdf.Generator.Text("Title");

header.Margin.Top = 30;

sec.Paragraphs.Add(header);

Aspose.Pdf.Generator.HeaderFooter footer = new Aspose.Pdf.Generator.HeaderFooter(sec);

Text text = new Text("Page $p van $P");

text.TextInfo.Alignment = Aspose.Pdf.Generator.AlignmentType.Right;

footer.Paragraphs.Add(text);

footer.DistanceFromEdge = 20;

footer.Margin.Bottom = 20;

sec.OddFooter = sec.EvenFooter = footer;

Aspose.Pdf.Generator.Table table = new Aspose.Pdf.Generator.Table();

float pageWidth = sec.PageInfo.PageWidth - pdf.PageSetup.Margin.Left - pdf.PageSetup.Margin.Right;

float column3 = 80f;

float column4 = 90f;

float column5 = 80f;

float column6 = 80f;

float column1 = (pageWidth - column3 - column4 - column5 - column6) / 2;

float column2 = column1;

table.ColumnWidths = column1.ToString() + " " + column2.ToString() + " " + column3.ToString() + " " + column4.ToString() + " " + column5.ToString() + " " +column6.ToString();

table.Margin.Top = 10;

Aspose.Pdf.Generator.MarginInfo margin = new Aspose.Pdf.Generator.MarginInfo();

margin.Top = 5f;

margin.Left = 5f;

margin.Right = 5f;

margin.Bottom = 5f;

table.DefaultCellPadding = margin;

string[] columnTitles = { "One", "Two", "Three", "Four", "Five", "Six" };

Aspose.Pdf.Generator.Row titleRow = table.Rows.Add();

titleRow.BackgroundColor = new Aspose.Pdf.Generator.Color(90);

foreach (string columnTitle in columnTitles)

titleRow.Cells.Add(columnTitle);

table.IsFirstRowRepeated = true;

bool rowColorSwitch = true;

Aspose.Pdf.Generator.GraphInfo Border_Total = new Aspose.Pdf.Generator.GraphInfo();

Border_Total.DashLengthInWhite = 2F;

Border_Total.LineWidth = 1F;

Border_Total.DashLengthInBlack = 1;

Border_Total.Color = new Aspose.Pdf.Generator.Color(0, 0, 0);

Aspose.Pdf.Generator.GraphInfo Border_End = new Aspose.Pdf.Generator.GraphInfo();

Border_End.Color = new Aspose.Pdf.Generator.Color(0, 0, 0);

Border_End.LineWidth = 1F;

//int[] jrow = {1,2,3,4,5,6,7,6,5,4,3,2,1,2,3,4,5,6,7,6};

int[] jrow = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };

Aspose.Pdf.Generator.Color rowA = new Aspose.Pdf.Generator.Color("white");

Aspose.Pdf.Generator.Color rowB = new Aspose.Pdf.Generator.Color("white");

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

{

Aspose.Pdf.Generator.Color color = (rowColorSwitch) ? rowA : rowB;

rowColorSwitch = !rowColorSwitch;

for (int j = 0; j < jrow[i]; j++)

{

Aspose.Pdf.Generator.Row row = table.Rows.Add();

row.BackgroundColor = color;

row.Cells.Add("row" + i.ToString() + " cell 1");

row.Cells.Add("cell 2");

row.Cells.Add("cell 3");

row.Cells.Add("cell 4");

row.Cells.Add("cell 5");

row.Cells.Add("cell 6");

}

}

sec.Paragraphs.Add(table);

pdf.Save(outPdf);

}