0
votes

I'm using the PDFTron/PDFNet library to develop a desktop PDF annotation system on visual studio 2015. I refer to a sample code offered: PDFViewSimple.cs . I want to write a simple freehand ink annotation function and get the data of the strokes to change the appearances.I used:

private void MenuToolFreeHand_Click(object sender, EventArgs e) { _pdfview.SetToolMode(PDFViewCtrl.ToolMod e.e_ink_create); }

and it just worked well. But I don't know how can I get the data of those ink strokes. I refer to the document,and find the such method below Ink class:

public Point GetPoint( int pathindex, int pointindex )

The Ink list is An array of n arrays, each representing a stroked path. Each array shall be a series of Point objects specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way.

The Ink list is just what I need, But when I want to get points data or time data of the strokes which users just write,I don't know where to find it.Is there a object which stores these data?

And I don't know is there an event trigger when users finished a stroke. If I use this e_ink_create tool,how can I change the opacity of one stroke?

1

1 Answers

3
votes

It is recomended to use PDFViewWPF (WPF) instead of PDFViewCtrl (WinForms) for new projects. Our PDFViewWPF control includes all the code you need to customize behaviour. In particular included in the SDK samples is PDFViewWPFTools project which contains everything you need. On the other hand PDFViewCtrl is not as customizable. I believe, even if your project is WinForms, you can still use PDFViewWPF. You just need to target .Net 4+.

If you really want to stick with PDFViewCtrl, then this forum post shows how to customize an annotation appearance. There are events you can register for with PDFViewCtrl, or you can simply get the last annotation on the page (as this will be the newest one).

This post shows how to traverse the ink points.

If you do switch to PDFViewWPF, then take a look at FreehandCreate.cs Create() and Draw() methods in the PDFViewWPF project.