we are using Infragistics.Documents.Reports and we observed that while generating report PDF - our contents are getting truncated if those are more than 2 pages in the grid. It shows total 3 page report where 3rd page displays with footer information and 1st page displays header part and detail report part and 2nd page also displays detail part. Data are coming properly as if i decrease padding then it shows me some of the truncated data which could fit into 2nd page but after 2nd page - it won't show any remaining data of the detail.
Any way to identify or recalculate page generation logic of the content if its now generating enough pages then can we generate explicitly but for that we need to know how many pages would be required to show this content and build up that logic as well..
any solution is recommended.
Hello Mosam,
Thank you for your post.
Ultragrid dosent have page functionality so may I know how did you set the grid in two pages and then trying to export that into pdf.
Is the issue occur only after decrease padding ?In order to understand the issue I set up a basic sample of Ultragrid pdf exporting, I would like you to modify the sample , help me reproducing the issue or send a small sample project of your own if you have one.
WinformsSample.zip
Hi Divya,
we are using System.Web.UI.WebControls.GridView for displaying data within grid and generate report using Infragistics.Documents.Reports methods. It generates PDF from byte[] generated from Memory stream using below code.
HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public); HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf"); HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("inline; filename={0}; size={1}", pdfFilename, pdf.Length)); HttpContext.Current.Response.BinaryWrite(pdf); HttpContext.Current.Response.Flush();
and it displays report details can't go beyond 2 pages and it displays header and footer properly. Footer generates on 3rd page.
if i decrease padding and margin of the page - then some of the report detail data which gets truncated starts coming on pdf report but after 2nd page - its not displaying any report detail data.
Pls let us know if you identify any root cause for this.
Here is how its getting bind using below method. It shows data properly in Grid but contents are getting cut off during preview in aspx file
public void bindgrid() { GrdMain.DataSource = filteredList; //GridMain type: System.Web.UI.WebControls.GridView GrdMain.DataBind();generatePager(resultState.TotalRecords, GrdMain.PageSize, resultState.GridPage); }
public void generatePager(long totalRowCount, int pageSize, int currentPage) {
//here totalRowCount is above 180 records int totalLinkInPage = 10; bool flag = false; int j = 0; int newpage;
int totalPageCount = (int)Math.Ceiling((decimal)totalRowCount / pageSize);
int startPageLink = Math.Max(currentPage - (int)Math.Floor((decimal)totalLinkInPage / 2), 1); int lastPageLink = Math.Min(startPageLink + totalLinkInPage - 1, totalPageCount);
if ((startPageLink + totalLinkInPage - 1) > totalPageCount) { lastPageLink = Math.Min(currentPage + (int)Math.Floor((decimal)totalLinkInPage / 2), totalPageCount); startPageLink = Math.Max(lastPageLink - totalLinkInPage + 1, 1); }
if (totalRowCount > pageSize) { List<string> pageLinkContainer = new List<string>();
if (currentPage == 0) currentPage = 1; if (startPageLink != 1) pageLinkContainer.Add("First"); if (currentPage > 10) pageLinkContainer.Add("<<");
float i = (float)currentPage; float t = i / 10; if (t == (float)Math.Floor((decimal)(currentPage / 10))) newpage = (Convert.ToInt32(Math.Floor((decimal)((i - 1) / 10))) * 10) + 1; else newpage = (Convert.ToInt32(Math.Floor((decimal)(i / 10))) * 10) + 1;
for (int temp = newpage; temp <= totalPageCount; temp++) { if (j < 10) { pageLinkContainer.Add(temp.ToString()); j++; if (temp == totalPageCount) { flag = true; break; } } else break; }
if (flag == false) { pageLinkContainer.Add(">>"); pageLinkContainer.Add("Last"); }
dlPager.DataSource = pageLinkContainer; dlPager.DataBind(); } }
can you pls let us know the suspected area which can cause this issue.
Thanks