{"id":4186,"date":"2018-01-08T16:18:38","date_gmt":"2018-01-08T08:18:38","guid":{"rendered":"http:\/\/blog.hoyo.idv.tw\/?p=4186"},"modified":"2018-07-24T10:11:56","modified_gmt":"2018-07-24T02:11:56","slug":"%e5%b0%87-windows-%e5%8a%9f%e8%83%bd%e8%bd%89%e6%8f%9b%e6%88%90-rest-api-%e4%bb%a5-microsoft-office-document-imaging-%e7%82%ba%e4%be%8b","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=4186","title":{"rendered":"\u5c07 Windows \u529f\u80fd\u8f49\u63db\u6210 REST API - \u4ee5 Microsoft Office Document Imaging \u70ba\u4f8b"},"content":{"rendered":"<h2>\u5c0f\u767d\u5148\u770b\u9019\u88e1<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.visualstudio.com\/zh-hant\/vs\/community\/\" target=\"_blank\" rel=\"noopener\">\u514d\u8cbb\u7684 IDE \u548c\u958b\u767c\u4eba\u54e1\u5de5\u5177 | Visual Studio Community<\/a><\/li>\n<li><a href=\"https:\/\/social.msdn.microsoft.com\/Forums\/zh-TW\/5bda1354-a472-4dbe-b191-c015bfcae85c?forum=232\" target=\"_blank\" rel=\"noopener\">\u8acb\u554f\u8a3b\u89e3...<\/a><\/li>\n<\/ul>\n<p>--<\/p>\n<h2>Microsoft Office Document Imaging \u4f7f\u7528\u5728 Windows Form \u7684\u60c5\u6cc1<\/h2>\n<ul>\n<li><a href=\"https:\/\/dotblogs.com.tw\/chou\/2009\/10\/05\/10909\" target=\"_blank\" rel=\"noopener\">[C#]\u4f7f\u7528 Microsoft Office Document Imaging(MODI) \u505a\u5149\u5b78\u5b57\u5143\u8fa8\u8b58(OCR)<\/a><\/li>\n<\/ul>\n<p>\u81f3\u5c11\u8981\u5148\u5728 Windows Form \u61c9\u7528\u7a0b\u5f0f\u5c08\u6848\u4e0b\u53ef\u4ee5\u9806\u5229\u904b\u4f5c\u6709\u57fa\u790e\u7684\u6982\u5ff5\uff0c\u624d\u6709\u8fa6\u6cd5\u8f49\u63db\u5230\u4e3b\u63a7\u53f0\u61c9\u7528\u7a0b\u5f0f<\/p>\n<p>--<\/p>\n<h2>\u547d\u4ee4\u63d0\u793a Console Application<\/h2>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/zh-tw\/dotnet\/csharp\/programming-guide\/main-and-command-args\/command-line-arguments\" target=\"_blank\" rel=\"noopener\">\u547d\u4ee4\u5217\u5f15\u6578 (C# \u7a0b\u5f0f\u8a2d\u8a08\u624b\u518a)<\/a><\/li>\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/38533903\/set-c-sharp-console-application-to-unicode-output\">Set C# console application to Unicode output<\/a><\/li>\n<\/ul>\n<p>\u6700\u5f8c Program.cs \u9577\u9019\u6a23<\/p>\n<pre class=\"lang:default decode:true \">using System;\r\nusing System.Drawing;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace ConsoleApplication2\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            string strResult = string.Empty;\r\n\r\n            \/\/ \u5ba3\u544a MODI.Document \u7269\u4ef6 modiDocument\uff0c\u4e26\u4e14\u5be6\u4f8b\u5316\r\n            MODI.Document modiDocument = new MODI.Document();\r\n\r\n            \/\/ MODI.Document \u5275\u5efa\r\n            modiDocument.Create(args[0]);\r\n\r\n            \/\/ \u5ba3\u544a MODI.Image \u7269\u4ef6 modiImage\uff0c\u5176\u5167\u5bb9\u503c\u4f86\u81ea MODI.Document \u7269\u4ef6 modiDocument\r\n            MODI.Image modiImage = (MODI.Image)modiDocument.Images[0];\r\n\r\n            \/\/ OCR Method(Language, WithAutoRotation, WithStraightenImage)\r\n            modiImage.OCR(MODI.MiLANGUAGES.miLANG_CHINESE_TRADITIONAL, false, false);\r\n\r\n            strResult = modiImage.Layout.Text;\r\n            modiDocument.Close(false);\r\n\r\n            \/\/ \u8f38\u51fa\u7d50\u679c\r\n            Console.OutputEncoding = Encoding.UTF8;\r\n            Console.WriteLine(strResult);\r\n        }\r\n\r\n    }\r\n\r\n}<\/pre>\n<p>--<\/p>\n<h2>\u4f7f\u7528 PHP \u5305\u88dd\u6210 REST API<\/h2>\n<p>\u5982\u6b64\u5373\u53ef\u5c07 GUI \u8f49\u63db\u6210 CLI \u65b9\u4fbf PHP \u4f7f\u7528<\/p>\n<pre class=\"lang:php decode:true\">&lt;?php\r\n$r = exec(' c:\\bin\\ocr.exe c:\\bin\\2.bmp ');\r\necho $r;<\/pre>\n<p>\u4f60\u554f REST API \u5728\u54ea\uff1f \u90fd\u8f49\u63db\u5230 PHP \u53ef\u4ee5\u76f4\u63a5\u53d6\u5f97\u8fa8\u8b58\u5f8c\u7d50\u679c\u4e86\uff0c\u5269\u4e0b\u7684\u5c31\u662f\u81ea\u5df1\u7684\u5275\u610f\u4e86\u554a<\/p>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"4186\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;1,472&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u767d\u5148\u770b\u9019\u88e1 \u514d\u8cbb\u7684 IDE ...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"4186\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;1,472&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[287],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4186"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4186"}],"version-history":[{"count":7,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4186\/revisions"}],"predecessor-version":[{"id":4193,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4186\/revisions\/4193"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}