Android
ComPDFKit PDF SDK
Guides

Edit Text and Images Properties


ComPDFKit provides multiple methods to modify text properties. You can modify text font size, name, color, alignment, italic, bold, transparency, etc. After modifying, you need to use CPDFPageView.operateEditTextSelect(CPDFPageView.EditTextSelectFuncType.ATTR) to update the display. The following code shows you how to set text to 12pt, red, and bold.  

 

cpdfEditTextSelections.setFontSize(12);
cpdfEditTextSelections.setFontColor(Color.RED);
cpdfEditTextSelections.setBold(true);
pageView.operateEditTextSelect(CPDFPageView.EditTextSelectFuncType.ATTR);

 

ComPDFKit provides multiple methods to modify image properties. You can modify image properties, such as rotating, cropping, mirroring, and setting transparency. The following code shows you how to rotate an image and set it to translucent.

 

pageView.operateEditImageArea(CPDFPageView.EditImageFuncType.TRANCPARENCY, 0.5);
pageView.operateEditImageArea(CPDFPageView.EditImageFuncType.ROTATE, 90.0f);


The following code shows you how to crop the image.

 

//Set callback when changing the image cropping area.
pageView.setCropCallback(new CPDFPageView.CropRectChangedCallback() {
                                @Override
                                public void onCropRectChange(RectF rect) {
                                   
                                }
                            });
//Start croping image.
pageView.enterImageAreaCrop();
//Update UI. The crop rect will appear. You can modify the crop rect.
pageView.invalidate();
//When you finish modifying the crop rect, call to crop the image.
pageView.operateEditImageArea(CPDFPageView.EditImageFuncType.CROP,null);
//If you don't want to crop the image, you can call following code to exit croping image.
//pageView.exitImageAreaCrop();
//pageView.invalidate();