I want to have a Callout annotation that has the arrow, and the text, but not the rectangular border around the text.
How do I remove that?
Unfortunately the PDF standard does not support this, so there is no API for it. For instance, if you did this, and then later someone resized or changed the color/text of the annotation in another PDF viewer, the rectangle border would re-appear.
However, you can edit the default appearance made by PDFTron, so that until someone changes it, which might never happen, it will not have the border as you want.
The code is below, based off of this other forum post.
static public void DisableRectBorder(Annot annot, PDFDoc doc)
ElementReader reader = new ElementReader();
ElementWriter writer = new ElementWriter();
ElementBuilder builder = new ElementBuilder();
writer.Begin(doc); // start new content stream
Obj old_app_stm = annot.GetAppearance();
bool firstPath = true;
while ((element = reader.Next()) != null)
if(firstPath && element.GetType() == Element.Type.e_path)
firstPath = false;
//element.SetPathFill(false); // optional
// not changing the size of the appearance so keep BBox value
Obj new_app_stm = writer.End();