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.
You can use CPDFViewer
's PDFEditActiveHandler
event to set the text and image properties. The following code will show you how to do this.
viewer.PDFEditActiveHandler += Viewer_PDFEditActiveHandler;
private void Viewer_PDFEditActiveHandler(object sender, PDFEditEvent e)
{
//Text properties.
if (e.EditType == CPDFEditType.EditText)
{
e.FontColor = Colors.Red;
e.FontSize = 12;
e.TextAlign = TextAlignType.AlignJustify;
e.FontWeight = FontWeights.Bold;
e.FontStyle = FontStyles.Italic;
e.FontFamily = new FontFamily("TimesNewRoman");
e.Transparency = 255;
e.UpdatePDFEditByEventArgs();
}
}
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.
viewer.PDFEditActiveHandler += Viewer_PDFEditActiveHandler;
private void Viewer_PDFEditActiveHandler(object sender, PDFEditEvent e)
{
//Image properties.
if (e.EditType == CPDFEditType.EditImage)
{
e.VerticalMirror = true;
e.HorizontalMirror = true;
e.ClipImage = true;
e.Rotate = 90;
e.ReplaceImagePath = "***";
e.Transparency = 255;
e.UpdatePDFEditByEventArgs();
}
}