Browse our Products

Aspose.PDF for Java 18.2 Release Notes

Features and Improvements

KeySummaryCategory
PDFJAVA-37494Creating NamedDestination in existing PDFEnhancement
PDFJAVA-37427Redaction API throws an exceptionBug
PDFJAVA-37380Output PDF - incorrect count of the bookmarksBug
PDFJAVA-35363Text extraction hikes memory utilizationBug
PDFJAVA-37371Sign and Encryption of a PDF fileBug
PDFJAVA-36574PDF to HTML - icon position is wrongBug
PDFJAVA-37218Import XSL-FO - absolute URI is too short error occurredBug
PDFJAVA-37016Some text at the top of the page is corrupted after conversion to HTML.Bug
PDFJAVA-37425Unable to delete a non-PDF file after PdfFileInfoBug
PDFJAVA-37218Import XSL-FO - absolute URI is too short error occurredBug
PDFJAVA-37372Tiff to PDF: Output file is empty when color type is GrayscaleBug

Enhancement - Creating NamedDestination in existing PDF

Related issue: PDFJAVA-37494

Description:

Some of our customers have requirement to create NamedDestination in existing PDF:

The method Document.getNamedDestinations() was implemented. This allows to manipulate with Named Destinations. 

NamedDestinationCollection has the 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.

Usage:

 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);

}

//let's 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");

Public API changes

Added new constructor: com.aspose.pdf.GoToAction.#ctor(Document,String)

Added new methods: com.aspose.pdf.HtmlSaveOptions.getDefaultFontName() com.aspose.pdf.HtmlSaveOptions.setDefaultFontName(String)

Added new method: com.aspose.pdf.IDocument.getNamedDestinations

Added new constructors: com.aspose.pdf.NamedDestination.#ctor(Document,String)

Added new interface com.aspose.pdf.nameddestinations.INamedDestinationCollection Methods: get_Item(String) set_Item(String,IAppointment) getCount() remove(String) add(String,IAppointment) getNames()

Added new class com.aspose.pdf.nameddestinations.NamedDestinationCollection Methods: get_Item(String) set_Item(String,IAppointment) getCount() remove(String) add(String,IAppointment) getNames()

Added new method: com.aspose.pdf.PdfFormatConversionOptions.getNotAccessibleFonts

Added new methods: com.aspose.pdf.RenderingOptions.getMaxFontsCacheSize() com.aspose.pdf.RenderingOptions.setMaxFontsCacheSize(int) com.aspose.pdf.RenderingOptions.getMaxSymbolsCacheSize() com.aspose.pdf.RenderingOptions.setMaxSymbolsCacheSize(int)

Added new methods: com.aspose.pdf.Table.getRepeatingColumnsCount() com.aspose.pdf.Table.setRepeatingColumnsCount(int)