Manipulate Content and Convert PDF in Aspose.PDF for Android via Java

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

After Aspose.PDF for Android via Java 17.7 release, we are honored to announce Aspose.PDF for Android via Java 17.12. Aspose.PDF for Android via Java 17.12 has been released for android platforms and ready to be used in Android Applications. For a detailed overview of the changes and improvements in this new release of the API, please visit release notes page in API documentation. However, there are following major features, we would like to mention, which have been added in Aspose.PDF for Android via Java 17.12.

Manipulate Tables in existing PDF

Aspose.PDF for Android via Java 17.12, now offers the feature to search and parse simple tables which already exist in PDF document. This new feature in the API has come with the addition of new class com.aspose.pdf.TableAbsorber which provides the capabilities to search and manipulate the tables in PDF documents. The usage of TableAbsorber is very much similar to existing TextFragmentAbsorber Class. The following code snippet shows the steps to update contents in particular table cell:

String inputPath = "/mnt/sdcard/Table.pdf";

String outputPath = "/mnt/sdcard/Table_out.pdf";

// Load document

Document pdfDocument = new Document(inputPath);

// Create TableAbsorber object to find tables

TableAbsorber absorber = new TableAbsorber();

// Visit first page with absorber

absorber.visit(pdfDocument.getPages().get_Item(1));

// Get access to first table on page, their first cell and
// text fragments in it

Table table = (Table) absorber.getTableList().get_Item(0);

Cell cell = table.getRows().get_Item(0).getCells().get_Item(0);

TextFragment fragment =
(TextFragment) cell.getParagraphs().get_Item(1);

// Change text of the first text fragment in the cell

fragment.setText ("Hello World!");

// Save updated document

pdfDocument.save(outputPath);

Apply Gradient Color

We have implemented support for gradient color in Aspose.PDF for Android via Java 17.12, in order to apply gradient color to the Graph. The feature can be used with new property PatternColorSpace and class GradientAxialShading which has been added into com.aspose.pdf.drawing Package. Following code snippet demonstrate the usage of new added properties and classes, in order to apply gradient color:

String outputPath = "/mnt/sdcard/GradientColor_out.xlsx";

// Initialize Document object

Document doc = new Document();

// Add a new page

Page page = doc.getPages().add();

Graph graph = new Graph(300, 300);

// Add a Graph

page.getParagraphs().add(graph);

com.aspose.pdf.drawing.Rectangle rect =
new com.aspose.pdf.drawing.Rectangle(0, 0, 300, 300);

graph.getShapes().add(rect);

rect.getGraphInfo().setFillColor(new com.aspose.pdf.Color());

// Use GradientAxialShadding for Gradient

GradientAxialShading gradientAxialShading =
new GradientAxialShading(Color.getRed(), Color.getBlue());

gradientAxialShading.setStart(new Point(0, 0));

gradientAxialShading.setEnd(new Point(300, 300));

rect.getGraphInfo().getFillColor().setPatternColorSpace(gradientAxialShading);

// Save the document

doc.save(outputPath);

Convert PDF File to Excel format

Since Inter-File Formats Conversion has been an interesting feature of the APIs offered by Aspose – we have added support to convert PDF file into Excel format, in Aspose.PDF for Android via Java 17.12. This new release of the API offers you following two different methods which can be used according to your requirements regarding conversion:

A sample code snippet and other required details about this feature has also been given in “Convert PDF file to Excel Format” article of API documentation.

Miscellaneous Fixes and Resources

Along with the new features, which have been shared above, we have also made some bug fixes in this release of the API – which can be seen in release notes section of the API documentation. Please visit the following links for information regarding latest release of Aspose.PDF for Android via Java and Release Notes section. In case you have any question about Aspose.PDF for Android via Java, you can post your inquiry in Aspose.PDF forums. We will be more than happy to assist you there.


To keep up with our news, you can follow us on Twitter or follow our Facebook page.