On this page
Guides
Edit Text and Image Properties
ComPDFKit supports to modify the properties of text and images. To configure text and image properties, you can utilize the PDFEditActiveHandler
event of CPDFViewer
.
Edit Text Properties
ComPDFKit supports modifying text properties, such as text font size, name, color, alignment, italics, bold, transparency, etc.
This example shows how to set text to 12pt, red, and bold:
C#
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();
}
}
Edit Image Properties
ComPDFKit supports modifying image properties, such as rotating, cropping, mirroring, and setting transparency.
This example shows how to rotate an image and set it to semi-transparent:
C#
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();
}
}