I'm trying to extract the ocr from an image using the onenote-API. So everything works just fine and as expected. But when I call method save from class OnenotePage, the OneNote-Application gets opened.
My code so far:
private const int PollInterval = 250;
private const int PollAttempts = 2;
public string RecognizeIntern(Image image)
{
var app = new Application();
var page = new OnenotePage(app);
page.Reload();
page.Clear();
page.AddImage(image);
page.Save()
int total = 0;
do
{
Thread.Sleep(PollInterval);
page.Reload();
string result = page.ReadOcrText();
if (result != null)
return result;
} while (total++ < PollAttempts);
return null;
}
my OnenotePage "save" method:
public void Save()
{
app.GetPageContent(this._pageId, out strXml, PageInfo.piBinaryData);
document = XDocument.Parse(strXml);
var xml = document.ToString();
app.UpdatePageContent(xml);
app.NavigateTo(this._pageId);
}
Any idea how to save without OneNote-Application gets opened?