#1
|
|||
|
|||
Set OCR Language with OneNote COM-API
I use the OneNote COM API and Python to recognize text from an image. To load a new image, I use method "UpdatePageContent" and it works very well.
Code:
import traceback import win32com.client def oneAddImage(OneNoteObject, PageID): try: ImagePath = r"C:\TestDir\TestImage.png" newContent = u'<?xml version="1.0"?><one:Page xmlns:one="http://schemas.microsoft.com/office/onenote/2013/onenote" ID="%s"><one:PageSettings RTL="false" color="automatic"><one:PageSize><one:Automatic/></one:PageSize><one:RuleLines visible="false"/></one:PageSettings><one:Image format="png" originalPageNumber="0"><one:Position x="36.0" y="86.4000015258789" z="0"/><one:File path="%s"/></one:Image></one:Page>'%(PageID, ImagePath) OneNoteObject = win32com.client.gencache.EnsureDispatch('OneNote.Application') OneNoteObject.UpdatePageContent(newContent, xsSchema=win32com.client.constants.xs2013) except Exception: print(str(traceback.format_exc())) return False Last edited by zizou2981; 02-22-2017 at 06:24 PM. |
Tags |
api, ocr, onenote 2013 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can not change Language in normal OneNote App - in OneNote 2016 it is possible | Ziselz | OneNote | 0 | 09-20-2016 11:23 PM |
Onenote 2016 desktop not syncing a particular page with onenote online | Akash | OneNote | 0 | 07-07-2016 11:16 AM |
OneNote "You must start OneNote before completing this task" after OneNote is open | anonymous | OneNote | 1 | 05-27-2015 07:55 PM |
OneNote app text is large when send to OneNote 2013 | raineysky | OneNote | 2 | 02-18-2015 07:37 AM |
Language settings are different in OneNote than other Office programs | tjuel | OneNote | 0 | 09-02-2012 06:54 AM |