Gradient Color Fill Support in Aspose.Pdf for Java 12.0.0

We are pleased to announce Aspose.Pdf for Java 12.0.0 release. As we know it is ported version of Aspose.Pdf for .NET, so it includes all the enhancements and improvements from the corresponding .NET version along with the fixes of the bugs reported in previous versions of Aspose.Pdf for Java by our customers. It contains support of Gradient Color fill besides enhancement of PDF to DOC conversion feature. In addition to above enhancement, we have some important improvements regarding Printing on Linux, PDF to PDFA, XML to PDF and Redaction Annotation. Please check release notes of Aspose.Pdf for Java 12.0.0 for complete list of bug fixed.

Please note if you are planning to upgrade the API from any previous version, we strongly suggest you to check the Public API Changes section of current release and other intermediate releases, to know what has been changed since your current revision of the API.

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

Gradient Color Fill Support

We have added Gradient Color fill support in this release. For this requirement, we have introduced PatternColorSpace property in com.aspose.pdf.Color class and GradientAxialShading class added in com.aspose.pdf.drawing package. Now we can fill Graph object with Gradient Color as following:



Document doc = new Document();

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

com.aspose.pdf.drawing.Graph graph = new com.aspose.pdf.drawing.Graph(300, 300);

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

com.aspose.pdf.drawing.GradientAxialShading gradientAxialShading = new com.aspose.pdf.drawing.GradientAxialShading(com.aspose.pdf.Color.getRed(), com.aspose.pdf.Color.getBlue());

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

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

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

doc.save("GradientFill.pdf");

 

Default Image Resolution of DOC(X) Document

We have received some queries regarding rendering quality of PDF to DOC(X) conversion. So we have set default ImageResolution to 300 dpi in this release. It will increase the output file size but for customers rendering quality of resultant DOC(X) is more important than file size. However, if required we can change the resolution of resultant DOC(X) as following:



com.aspose.pdf.DocSaveOptions saveOptions = new com.aspose.pdf.DocSaveOptions();

saveOptions.setFormat(com.aspose.pdf.DocSaveOptions.DocFormat.Doc);

saveOptions.setMode(com.aspose.pdf.DocSaveOptions.RecognitionMode.Flow);

saveOptions.setRecognizeBullets(true);

saveOptions.setImageResolutionX(150);

saveOptions.setImageResolutionY(150);

 

Aspose.Pdf for Java Resources

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