Asad Ali March 25, 20180 Comments

New Features and Enhancements in Aspose.PDF for Java 18.2

New Features and Enhancements in Aspose.PDF for Java 18.2

March 25, 2018
Share on FacebookTweet about this on TwitterShare on LinkedIn

We at Aspose are pleased to announce new version of Aspose.PDF for Java. As per regular monthly release process, Aspose.PDF for Java 18.2 has been released and available for download on our Maven Repository. Aspose.PDF for Java 18.2 is balancing release in which we have ported features from Aspose.PDF for .NET 18.2 API, in order to offer same set of features for both .NET and Java platforms. In order to have a look on what is new in this release of the API, we recommend you to visit release notes page of Aspose.PDF for Java 18.2. However, following are some features which we would like to highlight.

Create Named Destination in existing PDF Documents

With Aspose.PDF for Java 18.2, you can now create named destinations programmatically in your Java Application. We have implemented getNamedDestinations() method for com.aspose.pdf.Document Class, which allows you to manipulate Named Destinations in existing PDF documents. NamedDestinationCollection has following properties:

  • public IAppointment get_Item(String name); // Gets destination by its name
  • public void set_Item(String name, IAppointment value); // Sets destination by its name
  • public int getCount(); // Returns count of the destinations.
  • public void remove(String name); // Removes destination by its name.
  • public void add(String name, IAppointment appointment); // Adds new named destination.

Following code snippet demonstrates the usage of getNamedDestinations() method:

Document pdf = new Document();
// Create document with 100 pages
for (int i = 1; i <= 100; i++)
{
 Page page = pdf.getPages().add();
 page.addStamp(new com.aspose.pdf.TextStamp("Page " + i));
 // Named Destinations for every page
 pdf.getNamedDestinations().add("Page" + i, 
new com.aspose.pdf.XYZExplicitDestination(i, 0, 600, 0.5)); } for (int i = 1; i <= 100; i++) {
// Create outlines (two outlines for every page) com.aspose.pdf.OutlineItemCollection item1 = new
com.aspose.pdf.OutlineItemCollection(pdf.getOutlines()); item1.setDestination (new
com.aspose.pdf.NamedDestination(pdf, "Page" + i)); item1.setTitle ("Page " + i + "(1)"); pdf.getOutlines().add(item1); com.aspose.pdf.OutlineItemCollection item2 =
new com.aspose.pdf.OutlineItemCollection(pdf.getOutlines()); item2.setDestination (new
com.aspose.pdf.NamedDestination(pdf, "Page" + i)); item2.setTitle ("Page " + i + "(2)"); pdf.getOutlines().add(item2); } // Update on of the named destinations pdf.getNamedDestinations().set_Item("Page50",
new com.aspose.pdf.XYZExplicitDestination(50, 0, 100, 2)); pdf.save(myDir+"result.pdf");

Miscellaneous Fixes

As it is always recommended to use latest release of our API’s as they include latest features / improvements and fixes related to issues reported in earlier released versions. Therefore, please download the latest release of Aspose.PDF for Java 18.2.

 

Leave a comment

Posted inAspose.PDF Product Family, Asad Ali
 

Related Articles