Now, I'm testing PDFNet SDK and I have a couple of question to ask
your engineer.
1. When i draw an annotation (for example ellipse or rectangle) and
then try to obtain the annotation object in order to modify it in the
code.
I don't how to obtain the annotation object in the code, when i
selected the annotation on the view.
2. When I draw an annotation (for example ellipse or rectangle) and
change its size, the appearance is suddenly disappeared.
For example, if I draw an ellipse filled with red color and yellow
border then try to change its size,
red color is disappeared . so does yellow border. Please see the
attached picture.
Is there any way to solve this problem?
Now, I'm using the following codes;
pdfDoc.Lock();
Matrix screen2page = GetDeviceTransform(_cur_page);
screen2page.Invert();
PointF[] pt_arr = { _start_pt, _end_pt };
screen2page.TransformPoints(pt_arr);
Rect pos = new Rect(pt_arr[0].Y, pt_arr[0].X, pt_arr[1].Y,
pt_arr[1].X);
pos.Normalize();
pdftron.PDF.Annots.Circle circle =
pdftron.PDF.Annots.Circle.Create(pdfDoc, pos);//new
pdftron.PDF.Annots.Circle();
circle.SetBorderStyle(new
Annot.BorderStyle(Annot.BorderStyle.Style.e_solid, 1));
circle.SetColor(new ColorPt(Color.Red.R / 255.0, Color.Red.G / 255.0,
Color.Red.B / 255.0)); // 보더 컬러
ElementBuilder b = new ElementBuilder();
ElementWriter w = new ElementWriter();
w.Begin(pdfDoc);
double rx = pos.Width() / 2, ry = pos.Height() / 2;
Element element = b.CreateEllipse(pos.x1 + rx, pos.y1 + ry, rx, ry);
element.SetPathFill(true);
element.SetPathStroke(true);
GState gs = element.GetGState();
gs.SetStrokeColorSpace(ColorSpace.CreateDeviceRGB());
gs.SetStrokeColor(new ColorPt(Color.Blue.R / 255.0, Color.Blue.G /
255.0, Color.Blue.B / 255.0));
gs.SetLineWidth(1); // Stroke thickness
gs.SetFillColorSpace(ColorSpace.CreateDeviceRGB());
gs.SetFillColor(new ColorPt(Color.Red.R / 255.0, Color.Red.G / 255.0,
Color.Red.B / 255.0));
w.WriteElement(element);
pdftron.SDF.Obj oc = w.End();
w.Dispose();
b.Dispose();
oc.PutRect("BBox", pos.x1, pos.y1, pos.x2, pos.y2);
circle.SetAppearance(oc);
circle.SetActiveAppearanceState("On");
curPage.AnnotPushBack(circle);
pdfDoc.Unlock();
Update();
=====================================================================================