Having extracted the AFD file from the pen in a previous post I started poking around the contents of it. I then started looking through the LiveScribe desktop DLLs for methods that would help me in getting data out. My goal in this whole exploration of the AFD is to get stroke data off the pen and I managed to find that in the AFD file. I created a C# project and added the following references to “C:\Program Files\Livescribe\Livescribe Desktop\LS.Desktop.AFDDB.dll”. Once you add that reference to the project, you can get the stroke contents of the AFD file like so:


LS.Desktop.AFDDB.LSDocument doc = LS.Desktop.AFDDB.LSDocument.LoadDocument("YOURPATHHERE.AFD");

//Check for strokes
if (doc.HasStrokes(0))
{
Console.WriteLine("Has Strokes!");

//Go through each page
for (int pageno = 0; pageno < doc.pageInstances.Count; pageno++) { Console.WriteLine(string.Format("Page No {0}", pageno)); //Go through each stroke for (int strokeno = 0; strokeno < doc.pageInstances[pageno].NumStrokes; strokeno++) { Console.WriteLine(string.Format("\tStroke No {0}", strokeno)); //Go through the points foreach (Point p in doc.pageInstances[pageno].GetStroke(strokeno).Points) { Console.WriteLine(string.Format("\t\t({0}, {1})", p.X, p.Y)); } } } } else { Console.WriteLine("No Strokes!"); }

You can use that object to get other things too. If you have any questions or need help just send me an e-mail or post a comment. I would be glad to assist.

Leave a Reply

Your email address will not be published. Required fields are marked *