Multiple pages need to generate in single PDF file

Hi,

I am using Aspose.PDF for Java.

And generating each agent details report in separate PDF and merge the multiple pdf using concatenate method.

Instead of that any other possibility to generate multiple pages in single PDF.

Example:

Using one template, multiple pages need to generate in single PDF file.

@pandidurai1989

Thank you for contacting support.

You may add blank pages to a document and manipulate that page one after another and then save finalized document as per your requirements.

Document document = new Document();
// Add a blank page
Page page = document.getPages().add();
// TODO code here
// Add next page
page = document.getPages().add();

Or alternatively, you may create a list of PDF documents and iterate through those PDF documents while adding their pages to a single PDF document as explained in below code snippet:

Document document = new Document();
Document sourceDocument= new Document(dataDir + "Test.pdf");
// Add pages from one document to another document
document.getPages().add(sourceDocument.getPages());
// Save final document
document.save(dataDir + "Generated.pdf");

You may also visit Working with Pages for your kind reference. Feel free to contact us if you need any further assistance.