Tilal Ahmad Sana March 14, 2016one Comment

Change PDF colorspace from RGB to Grayscale, access XML elements during conversion and support of Alpha channel to create transparent text and drawing objects using Aspose.Pdf for Java 11.2.0

Change PDF colorspace from RGB to Grayscale, access XML elements during conversion and support of Alpha channel to create transparent text and drawing objects using Aspose.Pdf for Java 11.2.0

March 14, 2016
Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose.Pdf for Java 11.2.0 has been released. We are pleased to announce that new version of Aspose.Pdf for Java not only includes all the features and enhancements introduced in Aspose.Pdf for .NET 11.2.0 but also contains the feature to change PDF document colorspace form RGB to Grayscale and set background image of submit button. It also includes some important bug fixes along with above stated enhancements. Please check release notes of Aspose.Pdf for Java 11.2.0 for complete list of bug fixed.

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

Converting PDF document colorspace from RGB to Grayscale

We received a requirement to convert a PDF document colorspace from RGB to Grayscale, so that it would be faster while printing those PDF files. Also when file is converted to Grayscale, the size of document is reduced but with this change, the quality of document may drop. The feature is already supported in Aspose.Pdf for .NET version and now it is also supported in Java version of Aspose.Pdf i.e. Aspose.Pdf for Java 11.2.0. In order to accomplish this requirement, following code snippet can be used.

 

Document document = new Document(“input.pdf”);

com.aspose.pdf.RgbToDeviceGrayConversionStrategy strategy = newcom.aspose.pdf.RgbToDeviceGrayConversionStrategy();

for (int idxPage = 1; idxPage <= document.getPages().size(); idxPage++)

{

Page page = document.getPages().get_Item(idxPage);

strategy.convert(page);

}

document.save(“output.pdf”);

Add background image of submit button

One of the customers wants to set the background image for submit button over form. We can set background image of submit button by using addImage() method in DOM approach as following.

 

Document doc = new Document(“PdfWithAcroForm.pdf”);

com.aspose.pdf.ButtonField button = (com.aspose.pdf.ButtonField)doc.getForm().get_Item(“buttonField”);

java.awt.image.BufferedImage img = ImageIO.read(new File(“image.png”));

button.addImage(img);

doc.save(“output.pdf”);

 

Other Enhancements & Improvements

The other most notable enhancements in this release are as follow:

 

 

Aspose.Pdf for Java Resources

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

Join the Conversation

1 Comment

Leave a comment

Posted inAspose.PDF Product Family
 

Related Articles