TOC Indentation without Numbers & Image Optimization in PDF Documents are Enhanced in Aspose.Pdf for Java 11.9.0

Share on FacebookTweet about this on TwitterShare on LinkedIn

We are pleased to announce Aspose.Pdf for Java 11.9.0 has been released. It includes two enhancements, to add TOC indentation without numbering and PDF optimization. In addition to above enhancements, this version consist of some other important bug fixes as well. There have been specific improvements regarding PDF to PDFA, PDF to HTML, HTML to PDF and PDF to Images. Please check release notes of Aspose.Pdf for Java 11.9.0 for complete list of bug fixed.

The following sections describe some details regarding these enhancements/Improvements:

Add TOC indentation without numbers

TOC indentation: One of the customer has requirement to add TOC entries without numbering styles and add indentation to headings. We have implemented indentation without numbers and now able to use setIndentation() method to set indentation characters. But please take into account that, this is one of auto sequencing type with “None” NumberingStyle parameter.



final com.aspose.pdf.TocInfo tocInfo = new com.aspose.pdf.TocInfo();

....

tocInfo.setLevelIndentation(4);

....

final com.aspose.pdf.Heading heading2 = new com.aspose.pdf.Heading(level++);

heading2.setAutoSequence(true);

heading2.setStyle(NumberingStyle.None);

....

 

Image manipulation in PDF document optimization

During PDF optimization, sometimes it is required to change image resolution and image dimensions. Till last release this requirement was fulfilled by iterating through Page resources and using replace method of Image class. However we have implemented additional optimization methods to process optimization in one place.

optimizeOptions.setResolution(100): – we will update all the images resolution to the requested value.
optimizeOptions.setMaximumImageDimension(2500): – we will specifies the maximum image dimension. If the image width or height of the existing image is greater than this value – the image size will be proportionally reduced.



Document doc = new Document(myDir+"input.pdf");

OptimizationOptions optimizeOptions = new OptimizationOptions();

optimizeOptions.setRemoveUnusedObjects(true);

optimizeOptions.setLinkDuplcateStreams(true);

optimizeOptions.setRemoveUnusedStreams(true);

optimizeOptions.setCompressImages(true);

optimizeOptions.setImageQuality(60);

optimizeOptions.setResolution(100);

optimizeOptions.setMaximumImageDimension(2500);

doc.optimizeResources(optimizeOptions);

doc.save(myDir + "output.pdf");

 

Public API Changes

The major API change in this release is the legacy engine (package aspose.pdf.*) moved from the build to another jar file (aspose.pdf.legacy-11.9.0.jar) with deleting all the methods bind with it. License and AssemblyConstants classes for the legacy jar moved into the com.aspose.pdf.legacy package. All the other classes from the package aspose.pdf.* are not changed. Please check Public API Changes section in release notes for complete details of Public API changes of this release.

Aspose.Pdf for Java Resources

The following resources will help you work with Aspose.Pdf for Java: