When we run following code, extra page is produced:
PdfDocument document = new PdfDocument();
var brush = new PdfSolidBrush(System.Drawing.Color.Black);
var font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 10), true);
var section = document.Sections.Add();
section.PageSettings.Size = PdfPageSize.A4;
section.PageSettings.Orientation = PdfPageOrientation.Portrait;
section.PageSettings.Size = PdfPageSize.A4;
section.PageSettings.SetMargins(17, 17, 17, 17);
var page = section.Pages.Add();
// Set page numbers
PdfPageNumberField pageNumber = new PdfPageNumberField(font, brush);
PdfPageCountField count = new PdfPageCountField(font, brush);
System.Drawing.RectangleF bounds = new System.Drawing.RectangleF(0, 0, page.GetClientSize().Width - 34, 20);
PdfPageTemplateElement footer = new PdfPageTemplateElement(bounds)
{
Y = bounds.Y // Workaround for bug in Syncfusion 19.3460.0.53: when setting bounds, Y coordinate is not set from constructor.
};
PdfCompositeField compositeField = new PdfCompositeField(font, brush, "{0} of {1}", pageNumber, count)
{
StringFormat = new PdfStringFormat(PdfTextAlignment.Left),
Bounds = footer.Bounds
};
compositeField.Draw(footer.Graphics, new System.Drawing.PointF(0, 10));
section.Template.Bottom = footer;
// Page content
var layoutFormat = new PdfLayoutFormat
{Break = PdfLayoutBreakType.FitPage, Layout = PdfLayoutType.Paginate};
var rootGrid = new PdfGrid();
var rootColumn = rootGrid.Columns.Add();
rootColumn.Width = page.GetClientSize().Width - 34;
var rootRow = rootGrid.Rows.Add();
var rootCell = rootRow.Cells[0];
rootCell.Style.Borders.All = PdfPens.Green;
var firstInnerGrid = new PdfGrid();
firstInnerGrid.Columns.Add();
var headerRow = firstInnerGrid.Rows.Add();
headerRow.Cells[0].Value = "HEADING";
var rowForSecondInnerGrid = firstInnerGrid.Rows.Add();
var innerGrid = new PdfGrid();
innerGrid.Columns.Add();
innerGrid.Columns.Add();
for (int rowCounter = 0; rowCounter < 39; rowCounter++)
{
var row = innerGrid.Rows.Add();
row.Height = 19.76f;
row.Cells[0].Value = $"VALUE {rowCounter}";
row.Cells[1].Value = $"VALUE {rowCounter}";
}
rowForSecondInnerGrid.Cells[0].Value = innerGrid;
rootCell.Value = firstInnerGrid;
rootGrid.Draw(page, new System.Drawing.PointF(0, 0), layoutFormat);
using (FileStream stream = new FileStream("C:\\Test.pdf", FileMode.Create, FileAccess.ReadWrite))
{
document.Save(stream);
}
document.Close(true);
Hi umlprog,
We are planning to roll out our Volume 1 main release by this week. So there will be no weekly release this week. We have created a custom NuGet package with a reported fix for the issue “The rendering problem occurs when drawing a multi-child grid in the PDF document” in our latest NuGet version (v 19.4.0.56). Since our 2022 volume 1 main release is expected to be rolled out this week. We will include the fix for the reported issue in our upcoming weekly NuGet release once Volume 1 is rolled out which we excepted on the first week of April 2022 tentatively.
Note: The date and version will be updated later.
Please use the below link to download our custom NuGet package,
https://www.syncfusion.com/downloads/support/directtrac/general/ze/PackageWinForms-811116431.zip
Please refer to the below KB steps to install the custom NuGet package,
https://www.syncfusion.com/kb/11556/how-to-install-the-customer-patch-nuget-in-windows-machine
Please let us know if you need any further assistance with this.
Regards,
Gowthamraj K
Hi umlprog,
We will include the fix for this issue in our weekly NuGet release, which will be available on April 12th, 2022.
Please use the below feedback link to track the status of the reported bug.
Regards,
Gowthamraj K
Hi umlprog,
Sorry for the inconvenience,
The fix for the reported issue is not included in our latest weekly release. We have facing automation failure in existing cases and we will include the fix for this issue in our next weekly NuGet release, which will be available on April 19th, 2022.
Please use the below feedback link to
track the status of the reported bug.
Regards,
Gowthamraj K
Hi umlprog,
We have included the fix for the reported issue “The rendering problem occurs when drawing a multi-child grid in the PDF document” in our latest weekly NuGet release (v20.1.0.50). Please use the below link to download our latest weekly NuGet,
https://www.nuget.org/packages/Syncfusion.Pdf.WinForms/20.1.0.50
Please let us know if you have any concerns about this
Regards
Gowthamraj K