예제 #1
0
        /// <summary>
        /// Return the number of Journal pages from a XmlDocument (Microsoft format)
        /// </summary>
        /// <param name="filename">XML document's filename</param>
        /// <returns>Number of pages</returns>
        public static int NumberOfPages(string filename)
        {
            Stream      inkStream = File.OpenRead(filename);
            XmlDocument xmlDoc    = ReadJnt.GetMicrosoftXmlFromJournal(inkStream);

            //Please refer to http://support.microsoft.com/default.aspx?scid=kb;en-us;318545 for help
            XmlNamespaceManager manager = new XmlNamespaceManager(xmlDoc.NameTable);

            manager.AddNamespace("sketch", "urn:schemas-microsoft-com:tabletpc:journalreader");

            XmlNode pageNode = xmlDoc.SelectSingleNode("//sketch:JournalPage[last()]", manager);

            System.Xml.XmlAttribute attribute = pageNode.Attributes["Number"];

            return(Convert.ToInt32(attribute.Value));
        }
예제 #2
0
        private void ConvertToSketch(string filename, int pageNumber)
        {
            ByteHolder[] strokes;
            InkHolder[]  inks;

            Stream      inkStream   = File.OpenRead(filename);
            XmlDocument xmlDocument = ReadJnt.GetMicrosoftXmlFromJournal(inkStream);

            ArrayList convertedStrokes = new ArrayList();

            //The conversion process basically extracts Ink information
            //and puts it into our own Point/Stroke format.
            //The conversion process uses Converter.Converter.
            //Seek that file for specifics.
            strokes          = this.ExtractXmlInkObject(xmlDocument, pageNumber);
            inks             = this.CreateStrokes(strokes);
            convertedStrokes = this.CreateConvertedStrokes(inks);

            this.sketch.AddStrokes(convertedStrokes);
        }