PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
ComPDF offers various methods to modify text and image attributes.
ComPDF 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:
pdfView.setEditingSelectionFontSize(12.0)
pdfView.setEditingSelectionFontColor(.red)
pdfView.setCurrentSelectionIsBold(true)[pdfView setEditingSelectionFontSize:12.0];
[pdfView setEditingSelectionFontColor:[CPDFKitPlatformColor redColor]];
[pdfView setCurrentSelectionIsBold:YES];Below is the example code for creating and removing underlines and strikethroughs for text:
// creating underlines and strikethroughs for text
pdfView?.setCurrentSelectionShowUnderline(true, with: editingArea as? CPDFEditTextArea)
pdfView?.setCurrentSelectionShowStrikeout(true, with: editingArea as? CPDFEditTextArea)
// removing underlines and strikethroughs for text
pdfView?.setCurrentSelectionShowUnderline(false, with: editingArea as? CPDFEditTextArea)
pdfView?.setCurrentSelectionShowStrikeout(false, with: editingArea as? CPDFEditTextArea)// creating underlines and strikethroughs for text
[pdfView setCurrentSelectionShowUnderline:YES withTextArea:(CPDFEditTextArea *)editingArea];
[pdfView setCurrentSelectionShowStrikeout:YES withTextArea:(CPDFEditTextArea *)editingArea];
// removing underlines and strikethroughs for text
[pdfView setCurrentSelectionShowUnderline:NO withTextArea:(CPDFEditTextArea *)editingArea];
[pdfView setCurrentSelectionShowStrikeout:NO withTextArea:(CPDFEditTextArea *)editingArea];ComPDF 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:
pdfView.rotateEdit(pdfView.editingArea() as! CPDFEditImageArea, rotateAngle: 90)
/**
* Set the image transparency.
*/
pdfView.setImageTransparencyEdit(pdfView.editingArea() as! CPDFEditImageArea, transparency: 0.5)[pdfView rotateEditArea:pdfView.editingArea rotateAngle:90];
/**
* Set the image transparency.
*/
[pdfView setImageTransparencyEditArea:pdfView.editingArea transparency:0.5];