Render same template again with new page in aspose word java

I want to achieve if template render again, it should be start with new page, how we can do this? using java

@kalpeshAspose1997 If I understand properly, you are executing mail merge with regions and would like each record starts from a new page. In this case, you can configure the first paragraph of the region to start from a new page. You can achieve this by specifying “Page break before” option in paragraph properties:

I want to achieve if the same template render multiple time, it should be start with new page using java code

@kalpeshAspose1997 You can set the same paragraph property programmatically upon executing mail merge using IFieldMergingCallback. For example your region starts with merge field First_Field,then you can use the following implementation of IFieldMergingCallback:

private static class PageBreakBeforeCallback implements IFieldMergingCallback
{
    @Override
    public void fieldMerging(FieldMergingArgs args) throws Exception {
        if(args.getFieldName().equals("First_Field"))
        {
            // Get parent paragraph of the field.
            Paragraph parent = args.getField().getStart().getParentParagraph();
            // Set page break before property.
            parent.getParagraphFormat().setPageBreakBefore(true);
        }
    }
    
    @Override
    public void imageFieldMerging(ImageFieldMergingArgs args) throws Exception {
        // Do nothing
    }
}

But it is much easier to setup this in the template as I suggested in my previous answer.