Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Oct 06, 2016 6:57 pm

Hi

when a PdfTable.Draw command causes the table to be drawn over multiple pages, sometimes a row is split across pages, which results in a confusing display pattern (please see attached picture). Is this a known bug and something the team is planning to fix? If so, could you please let me know when this might be fixed?

bettori
 
Posts: 5
Joined: Wed Jul 27, 2016 3:37 pm

Fri Oct 07, 2016 3:08 am

Dear bettori,

Thanks for your inquiry.
Could you please provide us the codes you were using to help us reproduce the issue ? That would be very helpful to investigate it.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Oct 11, 2016 7:00 pm

Hi

protected float AddTableToDocOnPage(ReportTable table, float offset)
{
PdfLayoutResult result;

if(table.InsufficientSpaceOnPage(PdfDocumentSettings))
{
AddNewPage();
}

try
{
result = table.Draw(PdfDocumentSettings.CurrentPage, new PointF(0, PdfDocumentSettings.VerticalPosition));
}
catch (PdfTableException)
{
// In the unlikely event where the Spire library determines there is not enough space to print the table on the page
// and throws an exception, add a new page and print the table again
// Note: this will result in the header being displayed on the previous page unecessarily
AddNewPage();
result = table.Draw(PdfDocumentSettings.CurrentPage, new PointF(0, PdfDocumentSettings.VerticalPosition));
}

float tableSize = result.Bounds.Height;
int pageIndex = PdfDocumentSettings.Document.Pages.IndexOf(PdfDocumentSettings.CurrentPage);
int maxIndex = PdfDocumentSettings.Document.Pages.Count - 1;

if(pageIndex < maxIndex)
{
PdfDocumentSettings.CurrentPage = PdfDocumentSettings.Document.Pages[maxIndex];
PdfDocumentSettings.VerticalPosition = 10;
}

PdfDocumentSettings.VerticalPosition += (tableSize + offset);

return PdfDocumentSettings.VerticalPosition;
}

bettori
 
Posts: 5
Joined: Wed Jul 27, 2016 3:37 pm

Tue Oct 11, 2016 7:01 pm

In the code above, the table.Draw method is what is causing the bug.

bettori
 
Posts: 5
Joined: Wed Jul 27, 2016 3:37 pm

Wed Oct 12, 2016 6:35 am

Dear bettori,

Thanks for sharing the code, but sorry that we didn't reproduce the issue you mentioned with the code.
Could you please provide us sample project to demonstrate the issue you encountered ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF