Support of PDF/A_2U standard and Improved PDF Optimization in Aspose.Pdf for Java 16.12.0

Share on FacebookTweet about this on TwitterShare on LinkedIn

The new version of Aspose.Pdf for Java, 16.12.0, has been released. As Java version of Aspose.Pdf is ported version of Aspose.Pdf for .NET, so it includes all the enhancements and improvements from the corresponding .NET version(16.12.0) along with the fixes of the bugs reported in previous versions of Aspose.Pdf for Java reported by our valued customers that makes it more stable and reliable release as compared to previous releases. We have improved PDF to DOCX, PDF to PPTX feature, PDF to PDFA standard conversion along with many other bug fixes. Please check the detailed release notes of Aspose.Pdf for Java 16.12.0, in order to get an idea about the new features/enhancements and improvements made in this release of Aspose.Pdf for Java.

Furthermore, If you are planning to upgrade the API from any previous version, we strongly recommend you to check the Public API Changes section of current release and other intermediate releases from release notes pages, to know what has been changed since your current revision of the API.

 

The following sections describe some details regarding these newly added features/enhancements.

Support of PDF/A_2U standard

We have introduced new PDFA standard, PDF/A_2U, in Aspose.Pdf for Java 16.12.0. We have included a new value PDF_A_2U in PdfFormt enum. Please check following code snippet for new feature.


String inFile = "Input.pdf";
String outFile = "Output.pdf";
String outLog = "log.xml";
Document doc = new Document(inFile);
PdfFormatConversionOptions opts = new PdfFormatConversionOptions(outLog, PdfFormat.PDF_A_2U, ConvertErrorAction.Delete);
doc.convert(opts);
doc.save(outFile);

PDF optimization feature improved

In this release we have improved the PDF optimization feature with introduction of some new properties in OptimizationOption class. Mainly resizing of the embedded images reduces the PDF file size, ResizeImages and MaxResolution properties for the purpose along with RemovePrivateInfo:


Document document = new Document("input.pdf");
OptimizationOptions optimizationOptions =new OptimizationOptions();
optimizationOptions.setLinkDuplcateStreams(true);
optimizationOptions.setRemoveUnusedObjects(true);
optimizationOptions.setRemoveUnusedStreams(true);
optimizationOptions.setCompressImages(true);
optimizationOptions.setResizeImages(true);
optimizationOptions.setRemovePrivateInfo(true);
optimizationOptions.setImageQuality(50);
optimizationOptions.setMaxResoultion(75);
document.optimizeResources(optimizationOptions);
....

Rendering a specific PDF page region to image

We have a requirement to render a specific PDF page region to image. We have introduced following new methods in ImageDevice and TiffDevice classes..

getCropRectangle()

setCroptRectangle(com.aspose.pdf.Rectangle)


Document document = new Document("Input.pdf");
JpegDevice jpegDevice = new JpegDevice();
com.aspose.pdf.Rectangle rectangle = new com.aspose.pdf.Rectangle(200, 100, 400, 300);
jpegDevice.setCropRectangle(rectangle);
jpegDevice.process(document.getPages().get_Item(1), "Output.jpg");

Aspose.Pdf for Java Resources

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