Q: I’m interested in using your pdfnet api and am evaluating it. I
need to insert a caret and a text insert popup in a specific location
of a pdf file, to indicate some text that I want to include. I can do
this in Adobe Acrobat Standard, and I’m certain pdfnet can do it too.
Please send sample code that can produce the following file output
from the input file. I’m coding in C#.NET. Thanks!
A: You could use the following code to create a caret and a pop-up
int x = 282;
int y = 388;
Caret crt = pdftron.PDF.Annots.Caret.Create(doc, new Rect(x, y, x+10, y
crt.SetColor( new ColorPt( 1, 0, 0 ) ); // change caret's color to
crt.RefreshAppearance(); // this gives caret a default appearance, you
// have the option of generating your own appearance stream if you
// create a 'pop-up' annotation associated with the caret.
Popup pop = pdftron.PDF.Annots.Popup.Create(doc, new Rect(x+50, y+20, x
// Add annotations to the page.
... view refresh ? pdfview.UpdateAnnot/Rect()
You will notice that PDFViewSimple project includes a number of built-
in tools (which include ‘caret’ and pop-up create tool-modes) for
which you don't need to write any code. If built-in tools are not
doing exactly what you are looking for, you can also write your own