I am trying to create a custom tool to create Free Text annotation with oval / circular shape border. I have extended my class from Free text annotation but couldn’t find any documentation on how to add border to text anntation.
import com.pdftron.pdf.Annot
import com.pdftron.pdf.PDFViewCtrl
import com.pdftron.pdf.tools.FreeTextCreate
import com.pdftron.pdf.tools.ToolManager
class MarksAnnotation(ctrl: PDFViewCtrl) : FreeTextCreate(ctrl) {
companion object {
var MODE = ToolManager.ToolMode.addNewMode(Annot.e_FreeText)
}
override fun getToolMode(): ToolManager.ToolModeBase {
return MODE
}
override fun createFreeText() {
super.createFreeText()
}
}
Another option I have tried is CalloutCreate but the shape is rectangular.
Below is the output I am looking for. (The red text with circle)
Kindly point me in the right direction to achive the same.
This forum post shows how to edit the default appearances, so you can re-use the existing text layout logic, but change things like the border.
A possible improvement for your case, would be to make two annotations, a FreeText (with no border) and Circle, then read from both appearance streams and write to one single appearance, then discard the Circle and add the FreeText one to the page.
Note, that whenever you deviate from the default appearance, any future change to the annotation will result in it going back to the default appearance. For example, if someone later opens the PDF in another PDF viewer and edits the text, or resizes it, the round border would be lost.