How to display multiple tables/graphs in a aspose pdf page java

HI,

Could you please let me know, how to divide a pdf page to display multiple tables/graphs in single page?

Thanks,
Balakumar

@BalakumarSeethapathy,

Thanks for contacting support.

The Table, Graph, Image, TextFragment, Attachments, Annotations are added as separate element inside the PDF file and they are added in flow layout using Top-Left to Bottom-Right position. In case you need to add multiple elements, you can add them to paragraphs collection of PDF document.

However if your requirement is to add more than one element in a single line i.e. inline pattern, then you may consider creating a main table object and add the elements inside paragraphs collection of each table cell (consider using the approach of Nested tables). For more information, please visit How to Add table inside PDF file.

In case I have not properly understood your requirement or you have any further query, please feel free to contact.

@BalakumarSeethapathy,
You can retrieve a particular page region, and then convert it to the supported format, e.g. image. Finally, you can place this image anywhere into another PDF page. For example, you can retrieve the rectangle position of a table with the following code:

[Java]

// load PDF
Document pdfDocument = new Document("c:\\temp\\Document1.pdf");
// Create TableAbsorber object to find tables
TableAbsorber absorber = new TableAbsorber();
// visit first page with absorber
absorber.visit(pdfDocument.getPages().get_Item(1));
// get rectangle position of the first table
com.aspose.pdf.Rectangle rectangle = absorber.getTableList().get_Item(0).getRectangle();

In order to convert the particular page region to the image, and then place that image into another page of the PDF document, please refer to these help topics: Convert a particular page region to Image (DOM) and Add Image to Existing PDF File

Best Regards,
Imran Rafique