if the content continues to the next page, then the margins are not set. how to set ?
am placing all my contents to the grid cell and it is continuing to the next page. but it starts at the 0th position from top. How to set margins to all the pages.
//Set page margins
PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
PdfMargins margin = new PdfMargins();
margin.Top = unitCvtr.ConvertUnits(2f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Bottom = margin.Top;
margin.Left = unitCvtr.ConvertUnits(3f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Right = margin.Left;
PdfPageBase page = pdf.Pages.Add(PdfPageSize.A4,margin);
PdfDocument pdf = new PdfDocument();
//Margins
PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
PdfMargins margin = new PdfMargins();
margin.Top = unitCvtr.ConvertUnits(2f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Bottom = margin.Top;
margin.Left = unitCvtr.ConvertUnits(3f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point);
margin.Right = margin.Left;
PdfPageBase page = pdf.Pages.Add(PdfPageSize.A4,margin);
//The following is test data
String text = "Spire.PDF for .NET is a professional PDF API applied to creating, writing, editing, handling and reading PDF files without any external dependencies within .NET ( C#, VB.NET, ASP.NET, .NET Core) application. Using this .NET PDF library, you can implement rich capabilities to create PDF files from scratch or process existing PDF documents entirely through C#/VB.NET without installing Adobe Acrobat.";
String allText = text + text;
//Create a grid
PdfGrid grid = new PdfGrid();
grid.Columns.Add(1);
//Set the cell padding
grid.Style.CellPadding = new PdfPaddings(1, 1, 1, 1);
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 12f));
PdfStringFormat format = new PdfStringFormat();
format.Alignment = PdfTextAlignment.Left;
PdfGridRow row;
for (int i = 0; i < 10; i++)
{
row = grid.Rows.Add();
row.Cells[0].StringFormat = format;
row.Cells[0].Value = allText;
row.Cells[0].Style.Font = font;
}
PdfLayoutResult result = grid.Draw(page, new PointF(0, 0));
String output = "result1.pdf";
pdf.SaveToFile(output);