UploadFile.ts< / div >
DocumentHelper.ts< / div >
UploadFile.js< / div >
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2021领先的技术公司。保留所有权利。< !--END Copyright notice-->
DocumentHelper.js< / div >
UploadFile.html< / div >< / div >< div id ="GenericContainerEntry6366" class="GenericContainerEntry">
进口{DocumentHelper}从“. . / . . /工具/ DocumentHelper”;出口类DocumentFactory_UploadFileExample {公共构造函数(){lt.RasterSupport.setLicenseUri (“https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt”,“EVAL”,零);DocumentHelper.initFactory ();}公共运行= (buttonID:字符串)= > {常量exampleButton = . getelementbyid (buttonID);/ /添加一个文件选择常量fileInput = document.createElement (“输入”);fileInput。类型=“文件”;exampleButton.parentNode.appendChild (fileInput);/ /添加一个“上传”按钮常量uploadButton = document.createElement (“按钮”);uploadButton。类型=“按钮”;uploadButton。innerHTML =“点击上传”;exampleButton.parentNode.appendChild (uploadButton);uploadButton。onclick = () = > {常量文件= fileInput.files [0];如果(文件){alert (“没有文件!”);返回;}/ /上传它DocumentHelper.log (“上传……”);lt.Document.DocumentFactory.uploadFile(文件).done ((uri) = > {/ /完成,现在加载它DocumentHelper.log (“完成上传。现在加载……”);常量loadDocumentOptions =新lt.Document.LoadDocumentOptions ();/ /设置名称loadDocumentOptions.name = file.name;lt.Document.DocumentFactory。loadDocumentOptions loadFromUri (uri).done ((doc) = > {DocumentHelper.log (“已经成功加载文档”);DocumentHelper.log (“叫”+ doc.name);DocumentHelper.log (" MIMEType是“+ doc.mimeType);DocumentHelper.log (“的页面数量+ doc.pages.count);})fail (DocumentHelper.showServiceError);})fail (DocumentHelper.showServiceError);}}}
出口类DocumentHelper {静态showServiceError = (jqXHR statusText errorThrown) = > {alert (“从服务返回错误。有关详细信息,请参阅控制台”。);常量serviceError = lt.Document.ServiceError。parseError (jqXHR statusText errorThrown);console.error (serviceError);}静态日志=(信息:字符串、数据吗?任何)= > {常量outputElement = . getelementbyid (“输出”);如果(outputElement) {常量时间= (新日期()).toLocaleTimeString ();常量textElement = document.createElement (“p”);textElement。innerHTML =(outputElement。childElementCount + 1) +“(”+时间+“:”+消息;outputElement。方法(textElement outputElement.firstChild);}如果数据(!)console.log(消息);其他的控制台。日志(消息、数据);}静态initFactory = () = > {/ /与DocumentsService通信,它必须运行!/ /更改这些参数匹配服务的路径。lt.Document.DocumentFactory。serviceHost =“http://localhost: 40000”;lt.Document.DocumentFactory。servicePath =”“;lt.Document.DocumentFactory。serviceApiPath =“api”;}}
进口{DocumentHelper}从“. . / . . /工具/ DocumentHelper”;出口类DocumentFactory_UploadFileExample {构造函数(){lt.RasterSupport.setLicenseUri (“https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt”,“EVAL”,零);DocumentHelper.initFactory ();}运行= (buttonID) = > {常量exampleButton = . getelementbyid (buttonID);/ /添加一个文件选择常量fileInput = document.createElement (“输入”);fileInput。类型=“文件”;exampleButton.parentNode.appendChild (fileInput);/ /添加一个“上传”按钮常量uploadButton = document.createElement (“按钮”);uploadButton。类型=“按钮”;uploadButton。innerHTML =“点击上传”;exampleButton.parentNode.appendChild (uploadButton);uploadButton。onclick = () = > {常量文件= fileInput.files [0];如果(文件){alert (“没有文件!”);返回;}/ /上传它DocumentHelper.log (“上传……”);lt.Document.DocumentFactory.uploadFile(文件).done ((uri) = > {/ /完成,现在加载它DocumentHelper.log (“完成上传。现在加载……”);常量loadDocumentOptions =新lt.Document.LoadDocumentOptions ();/ /设置名称loadDocumentOptions.name = file.name;lt.Document.DocumentFactory。loadDocumentOptions loadFromUri (uri).done ((doc) = > {DocumentHelper.log (“已经成功加载文档”);DocumentHelper.log (“叫”+ doc.name);DocumentHelper.log (" MIMEType是“+ doc.mimeType);DocumentHelper.log (“的页面数量+ doc.pages.count);})fail (DocumentHelper.showServiceError);})fail (DocumentHelper.showServiceError);}}}
出口类DocumentHelper {静态showServiceError = (jqXHR statusText errorThrown) = > {alert (“从服务返回错误。有关详细信息,请参阅控制台”。);常量serviceError = lt.Document.ServiceError。parseError (jqXHR statusText errorThrown);console.error (serviceError);}静态日志=(消息、数据)= > {常量outputElement = . getelementbyid (“输出”);如果(outputElement) {常量时间= (新日期()).toLocaleTimeString ();常量textElement = document.createElement (“p”);textElement。innerHTML =(outputElement。childElementCount + 1) +“(”+时间+“:”+消息;outputElement。方法(textElement outputElement.firstChild);}如果数据(!)console.log(消息);其他的控制台。日志(消息、数据);}静态initFactory = () = > {/ /与DocumentsService通信,它必须运行!/ /更改这些参数匹配服务的路径。lt.Document.DocumentFactory。serviceHost =“http://localhost: 40000”;lt.Document.DocumentFactory。servicePath =”“;lt.Document.DocumentFactory。serviceApiPath =“api”;}}
< !doctype html >< html lang =“en”><标题>文档例子|还是< /名称><头>< script src =“https://code.jquery.com/jquery-2.2.4.min.js”诚信=“sha256-BbhdlvQf / xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44 = "crossorigin =“匿名”> < /脚本>< script src =“. . / . . / LT / Leadtools.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Controls.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.Engine.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.Designers.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.Rendering.Javascript.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.Automation.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.ImageProcessing.Main.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.ImageProcessing.Color.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.ImageProcessing.Core.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.ImageProcessing.Effects.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Document.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Document.Viewer.js”> < /脚本>< link rel =“样式表”类型=“文本/ css”href =“. . / . . / css / examples.css”>< !——所有演示文件捆绑和附加到窗口- - >< script src =“. . / . . / bundle.js”类型=“text / javascript”> < /脚本>< / >头<身体>< div ><按钮类型=“按钮”id =“exampleButton”> > < /按钮运行例子< / div >< div id =“输出”> < / div >< div >< img id =“img”/ >< / div >< /身体><脚本>窗口。onload = () = > {常量示例=新window.examples.DocumentFactory.UploadFile ();example.run (“exampleButton”);};> < /脚本< / html >
需求< / div >目标平台
帮助21.0.2021.7.2版本< / div >< !--BEGIN Copyright notice-->
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2021领先的技术公司。保留所有权利。< !--END Copyright notice-->
©1991 - 2021领先的技术公司。保留所有权利。< !--END Copyright notice-->
Leadtools。文档一个ssembly< / div >
188金宝搏的网址客服|支持|介绍|< / div >< div id ="HeaderHelpVersion">
帮助21.0.2021.7.2版本< / div >< div id ="MobileTOC">
下载免费评估< / div >< div id ="searchBoxForm">
引用▼< / div >
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗Web查看器net
188宝金博怎么下载
支持的平台上
net, Java, Android和iOS / macOS组件
C / c++类库的API
HTML5 JavaScript库
LEADTOOLS聊天< / div >< div >
加载……< / div >< / div >< div id ="email-sent-container" class="hidden-group">
你的邮件已经发送到支持!有人应该联系!如果你的问题是紧急请回到聊天。
聊天时间:
周一——周五,上午6点等
谢谢你的反馈!
请填写表单重新开始一个新的聊天。
所有代理目前离线。
聊天时间:
周一-周五
早上8:30 - 6点
联系我们请填写这张表格,我们将通过电子邮件联系你。
名字是必需的。
姓是必需的。
需要有效的电子邮件(e。g example@example.com)。
问题不能为空。
支持销售许可< / div >
上传…
谢谢你的反馈!祝你有美好的一天!
谈话已经结束。请填写以下调查!
我的问题是解决了。
这个字段是必需的。
代理的技术知识< / div >
这个字段是必需的。
代理的沟通技巧< / div >
这个字段是必需的。
©1991 - 2021领先的技术公司。保留所有权利。< !--END Copyright notice-->
