Printing issue on page

While iterating list data and printing on pdf
i have attached cos.pdf in this product came in one page and product related data come on next page.

i want a solution if current page have very less space then whole data print in a new page

Please found issue on attached pdf.

Hi Ram,

Thanks for your inquiry. I am afraid Aspose.Pdf does not support adjusting a page dynamically while printing. However when you are creating a new PDF document you can add related information group into PDF using nested tables. By default nested table data remain together on a page. Please check sample code snippet for the purpose.

var _pdf = new Document();
float marginInPixels = (float)(72 * 0.5);
Aspose.Pdf.MarginInfo margin = new Aspose.Pdf.MarginInfo();
margin.Top = marginInPixels;
margin.Left = marginInPixels;
margin.Right = marginInPixels;
margin.Bottom = marginInPixels;

_pdf.PageInfo.Margin = margin;
_pdf.PageInfo.Height = Aspose.Pdf.PageSize.PageLetter.Height;
_pdf.PageInfo.Width = Aspose.Pdf.PageSize.PageLetter.Width;

Page section = _pdf.Pages.Add();

Aspose.Pdf.Table hTable = new Aspose.Pdf.Table();
hTable.Alignment = Aspose.Pdf.HorizontalAlignment.Left;

int groupCounter = 0;

for (Int32 i = 0; i <= 100 - 1; i++)
{
    groupCounter += 1;
    var aRow = hTable.Rows.Add();
    var aCell = aRow.Cells.Add();

    //Create a table to be nested with the reference of 2nd cell in the row
    Aspose.Pdf.Table tab2 = new Aspose.Pdf.Table();
    //tab2.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.5f, Aspose.Pdf.Color.Black);
    tab2.DefaultCellPadding = new Aspose.Pdf.MarginInfo
    {
        Bottom = 1,
        Left = 1,
        Right = 1,
        Top = 1
    };
    tab2.Alignment = Aspose.Pdf.HorizontalAlignment.Left;

    //Add the nested table into the paragraphs collection of the cell
    aCell.Paragraphs.Add(tab2);

    for (int cnt = 1; cnt <= 5; cnt++)
    {
        //Create row in the nested table
        Aspose.Pdf.Row row21 = tab2.Rows.Add();

        var aCell1 = row21.Cells.Add();
        aCell1.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment("value 1"));

        var aCell2 = row21.Cells.Add();
        aCell2.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment("Group " + groupCounter));
    }
}

section.Paragraphs.Add(hTable);
_pdf.Save(myDir + "TestTable_group.pdf");

Please feel free to contact us for any further assistance.

Best Regards,