在这个话题▼< / div >< div id ="inThisTopicDialog" class="hide">

rotatePages方法

总结< / div >

旋转一个或多个页面指定值。

语法< / div >< div id ="mainSourceContainerSyntax">
打印稿< / div >< div类="sourceContainerTab" id="JavaScriptSyntaxTab" onclick="$.selectCodeContainer(this)"> JavaScript< / div >< / div >< div类="codeExample codeContainer JavaScriptSyntax hide">
DocumentViewer.prototype。rotatePages =函数(pageNumbers,)
rotatePages (pageNumbers:数量[],:数量):无效;

参数

pageNumbers

页码旋转。这应该是基于一个或多个项目的页码。使用旋转中的所有页面文档查看器。

度的角度。必须在90度的增量。顺时针旋转执行积极的价值观和逆时针负值。

讲话< / div >

此方法执行以下:

对于每个页面中指定的数量pageNumbers

  1. 找到相应的DocumentPage对象和调用DocumentPage.Rotate方法。

  2. 旋转相应的AnnContainer如果任何。

  3. 重置页面的文本。

操作为每个页面的事件会发生DocumentViewerOperation设置为PageRotate

例子< / div >

从示例中创建的主题是,删除所有的代码功能,添加下面的代码示例。

当用户单击按钮,当前活动页面旋转90度。再次点击按钮的例子将被另一个90度旋转的页面。

RotatePages.ts< / div >< div类="GenericEntry GenericContainerTab" id="GenericContainerEntry4838Tab" onclick="$.selectGenericContainer(this)"> ViewerInitializer.ts< / div >< div类="GenericEntry GenericContainerTab" id="GenericContainerEntry16563Tab" onclick="$.selectGenericContainer(this)"> RotatePages.js< / div >< div类="GenericEntry GenericContainerTab" id="GenericContainerEntry18139Tab" onclick="$.selectGenericContainer(this)"> ViewerInitializer.js< / div >< div类="GenericEntry GenericContainerTab" id="GenericContainerEntry29077Tab" onclick="$.selectGenericContainer(this)"> RotatePages.html< / div >< div类="GenericEntry GenericContainerTab" id="GenericContainerEntry35547Tab" onclick="$.selectGenericContainer(this)"> examples.css< / div >< / div >< div id ="GenericContainerEntry3187" class="GenericContainerEntry">
进口{ViewerInitializer}从“. . /工具/ ViewerInitializer”;出口RotatePagesTSExample {公共运行= ()= > {ViewerInitializer (.addOperationEvent);}addOperationEvent =(主题是:lt.Document.Viewer.DocumentViewer) = > {常量outputElement = . getelementbyid (“输出”);/ /添加一个按钮旋转页面常量按钮= document.createElement (“按钮”);outputElement.appendChild(按钮);按钮。innerHTML =“旋转页面”;按钮。onclick =函数(){常量pageNumber = documentViewer.currentPageNumber;主题是。rotatePages ([pageNumber], 90);}}}
出口ViewerInitializer {私人回调:(观众:lt.Document.Viewer.DocumentViewer) = >无效=;构造函数(回调?:(viewer: lt.Document.Viewer.DocumentViewer) =>无效){.callback =回调;.init ();}公共静态showServiceError = (jqXHR statusText errorThrown) = > {alert (从服务返回的错误。有关详细信息,请参阅控制台。)常量serviceError = lt.Document.ServiceError。parseError (jqXHR statusText errorThrown);console.error (serviceError);}私人init = () = > {.initFactory ();.testConnection ();}私人initFactory = () = > {lt.RasterSupport.setLicenseUri (“https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt”,“EVAL”,);/ /与DocumentsService通信,它必须运行!/ /更改这些参数匹配服务的路径。lt.Document.DocumentFactory。serviceHost =“http://localhost: 40000”;lt.Document.DocumentFactory。servicePath =;lt.Document.DocumentFactory。serviceApiPath =“api”;}私人testConnection = () = > {常量serviceStatus = . getelementbyid (“serviceStatus”);serviceStatus。innerHTML =“连接到服务:”+ lt.Document.DocumentFactory.serviceUri;lt.Document.DocumentFactory.verifyService ().done ((serviceData) = > {serviceStatus。innerHTML =“服务连接验证!”;.createDocumentViewer ();})fail ((jqXHR statusText errorThrown) = > {serviceStatus。innerHTML =服务连接不可用。;ViewerInitializer。showServiceError (jqXHR statusText errorThrown);});}私人createDocumentViewer = () = > {/ /初始化用户界面常量interactiveSelect = . getelementbyid (“interactiveSelect”);常量panZoomOption = document.createElement (“选项”);panZoomOption。innerHTML =“锅/缩放”;panZoomOption。值= lt.Document.Viewer.DocumentViewerCommands.interactivePanZoom;interactiveSelect.appendChild (panZoomOption);常量textOption = document.createElement (“选项”);textOption。值= lt.Document.Viewer.DocumentViewerCommands.interactiveSelectText;textOption。innerHTML =“选择文本”;interactiveSelect.appendChild (textOption);让主题是:lt.Document.Viewer。是=;interactiveSelect。onchange = (e) = > documentViewer.commands.run ((e。target HTMLSelectElement) value,);常量annotationsSelect = . getelementbyid (“annotationsSelect”);常量annSelectOption = document.createElement (“选项”);annSelectOption。innerHTML =“选择注释”;annSelectOption。值= lt.Annotations.Engine.AnnObject.selectObjectId.toString ();annotationsSelect.appendChild (annSelectOption);常量annLineOption = document.createElement (“选项”);annLineOption。innerHTML =“行对象”;annLineOption。值= lt.Annotations.Engine.AnnObject.lineObjectId.toString ();annotationsSelect.appendChild (annLineOption);常量annRectOption = document.createElement (“选项”);annRectOption。innerHTML =“矩形对象”;annRectOption。值= lt.Annotations.Engine.AnnObject.rectangleObjectId.toString ();annotationsSelect.appendChild (annRectOption);annotationsSelect。onchange = (e) = > {常量值= + (e。currentTarget HTMLSelectElement) value;documentViewer.annotations.automationManager。currentObjectId =价值;}/ /初始化文档查看器,通过沿板常量createOptions =lt.Document.Viewer.DocumentViewerCreateOptions ();/ /我们不会在本例中使用元素模式createOptions.viewCreateOptions。useElements =;createOptions.thumbnailsCreateOptions。useElements =;/ /中间面板视图createOptions。viewContainer = . getelementbyid (“观众”);/ /缩略图的左侧面板createOptions。thumbnailsContainer = . getelementbyid (“缩略图”);/ /右面板是书签createOptions。bookmarksContainer = . getelementbyid (“书签”);createOptions。useAnnotations =真正的;/ /创建文档查看器是= lt.Document.Viewer.DocumentViewerFactory.createDocumentViewer (createOptions);/ /我们喜欢SVG查看documentViewer.view。preferredItemType = lt.Document.Viewer.DocumentViewerItemType.svg;/ /创建html5的渲染引擎documentViewer.annotations.automationManager。renderingEngine =lt.Annotations.Rendering.AnnHtml5RenderingEngine ();/ /初始化是注释documentViewer.annotations.initialize ();documentViewer.annotations.automationManager.currentObjectIdChanged.add (函数(发送者,e) {/ /如果做画,经理将返回到选择对象;所以我们需要迫使annotationsSelect元素返回选择对象的选择(annotationsSelect HTMLSelectElement)。值= sender.currentObjectId;});.loadDefaultDoc(主题是interactiveSelect HTMLSelectElement)}私人loadDefaultDoc =(观众:lt.Document.Viewer。文档Viewer, interactiveSelect: HTMLSelectElement) => {/ /加载一个PDF文档常量url =“https://demo.leadtools.com/images/pdf/leadtools.pdf”;lt.Document.DocumentFactory.loadFromUri (url,).done((医生:lt.Document.LEADDocument) = > {常量准备好了= ()= > {viewer.setDocument (doc);常量panZoom = lt.Document.Viewer.DocumentViewerCommands.interactivePanZoom;interactiveSelect。值= panZoom;viewer.commands.run (panZoom);如果(.callback).callback(观众);}如果(医生。isStructureSupported & & ! doc.structure.isParsed)doc.structure.parse ().done(准备好了)fail (ViewerInitializer.showServiceError);其他的准备好();})fail (ViewerInitializer.showServiceError);}}
进口{ViewerInitializer}从“. . /工具/ ViewerInitializer”;出口RotatePagesJSExample {运行= ()= > {ViewerInitializer (.addOperationEvent);}addOperationEvent =(是)= > {常量outputElement = . getelementbyid (“输出”);/ /添加一个按钮旋转页面常量按钮= document.createElement (“按钮”);outputElement.appendChild(按钮);按钮。innerHTML =“旋转页面”;按钮。onclick =函数(){常量pageNumber = documentViewer.currentPageNumber;主题是。rotatePages ([pageNumber], 90);}}}
出口ViewerInitializer {构造函数(回调){.callback =回调;.init ();}静态showServiceError = (jqXHR statusText errorThrown) = > {alert (“从服务返回错误。有关详细信息,请参阅控制台”。)常量serviceError = lt.Document.ServiceError。parseError (jqXHR statusText errorThrown);console.error (serviceError);}init = () = > {.initFactory ();.testConnection ();}initFactory = () = > {lt.RasterSupport.setLicenseUri (“https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt”,“EVAL”,);/ /与DocumentsService通信,它必须运行!/ /更改这些参数匹配服务的路径。lt.Document.DocumentFactory。serviceHost =“http://localhost: 40000”;lt.Document.DocumentFactory。servicePath =”“;lt.Document.DocumentFactory。serviceApiPath =“api”;}testConnection = () = > {常量serviceStatus = . getelementbyid (“serviceStatus”);serviceStatus。innerHTML =“连接到服务:“+ lt.Document.DocumentFactory.serviceUri;lt.Document.DocumentFactory.verifyService ().done ((serviceData) = > {serviceStatus。innerHTML =“服务连接验证!”;.createDocumentViewer ();})fail ((jqXHR statusText errorThrown) = > {serviceStatus。innerHTML =“服务连接不可用。”;ViewerInitializer。showServiceError (jqXHR statusText errorThrown);});}createDocumentViewer = () = > {/ /初始化用户界面常量interactiveSelect = . getelementbyid (“interactiveSelect”);常量panZoomOption = document.createElement (“选项”);panZoomOption。innerHTML =“锅/缩放”;panZoomOption。值= lt.Document.Viewer.DocumentViewerCommands.interactivePanZoom;interactiveSelect.appendChild (panZoomOption);常量textOption = document.createElement (“选项”);textOption。值= lt.Document.Viewer.DocumentViewerCommands.interactiveSelectText;textOption。innerHTML =“选择文本”;interactiveSelect.appendChild (textOption);我们是=;interactiveSelect。onchange = (e) = > documentViewer.commands.run (e.target.value,);常量annotationsSelect = . getelementbyid (“annotationsSelect”);常量annSelectOption = document.createElement (“选项”);annSelectOption。innerHTML =“选择注释”;annSelectOption。值= lt.Annotations.Engine.AnnObject.selectObjectId.toString ();annotationsSelect.appendChild (annSelectOption);常量annLineOption = document.createElement (“选项”);annLineOption。innerHTML =“对象”;annLineOption。值= lt.Annotations.Engine.AnnObject.lineObjectId.toString ();annotationsSelect.appendChild (annLineOption);常量annRectOption = document.createElement (“选项”);annRectOption。innerHTML =“矩形对象”;annRectOption。值= lt.Annotations.Engine.AnnObject.rectangleObjectId.toString ();annotationsSelect.appendChild (annRectOption);annotationsSelect。onchange = (e) = > {常量值= + e.currentTarget.value;documentViewer.annotations.automationManager。currentObjectId =价值;}/ /初始化文档查看器,通过沿板常量createOptions =lt.Document.Viewer.DocumentViewerCreateOptions ();/ /我们不会在本例中使用元素模式createOptions.viewCreateOptions。useElements =;createOptions.thumbnailsCreateOptions。useElements =;/ /中间面板视图createOptions。viewContainer = . getelementbyid (“观众”);/ /缩略图的左侧面板createOptions。thumbnailsContainer = . getelementbyid (“缩略图”);/ /右面板是书签createOptions。bookmarksContainer = . getelementbyid (“书签”);createOptions。useAnnotations =真正的;/ /创建文档查看器是= lt.Document.Viewer.DocumentViewerFactory.createDocumentViewer (createOptions);/ /我们喜欢SVG查看documentViewer.view。preferredItemType = lt.Document.Viewer.DocumentViewerItemType.svg;/ /创建html5的渲染引擎documentViewer.annotations.automationManager。renderingEngine =lt.Annotations.Rendering.AnnHtml5RenderingEngine ();/ /初始化是注释documentViewer.annotations.initialize ();documentViewer.annotations.automationManager.currentObjectIdChanged.add (函数(发送者,e) {/ /如果做画,经理将返回到选择对象;所以我们需要迫使annotationsSelect元素返回选择对象的选择annotationsSelect。值= sender.currentObjectId;});interactiveSelect .loadDefaultDoc(是)}interactiveSelect loadDefaultDoc =(观众)= > {/ /加载一个PDF文档常量url =“https://demo.leadtools.com/images/pdf/leadtools.pdf”;lt.Document.DocumentFactory.loadFromUri (url,).done ((doc) = > {常量准备好了= ()= > {viewer.setDocument (doc);常量panZoom = lt.Document.Viewer.DocumentViewerCommands.interactivePanZoom;interactiveSelect。值= panZoom;viewer.commands.run (panZoom);如果(.callback).callback(观众);}如果(医生。isStructureSupported & & ! doc.structure.isParsed)doc.structure.parse ().done(准备好了)fail (ViewerInitializer.showServiceError);其他的准备好();})fail (ViewerInitializer.showServiceError);}}
< !doctype html >< html lang =“en”><标题> DocViewer例子|主题是< /名称><头>< 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=“容器”>< div=“工具栏”>< div=“vcenter push-right”><按钮类型=“按钮”id =“exampleButton”> > < /按钮运行例子< / div >< div=“vcenter push-right”><标签=“interactiveSelect”> >交互模式:< /标签<选择id =“interactiveSelect”> < /选择>< / div >< div=“vcenter push-right”><标签=“annotationsSelect”> >注释对象:< /标签<选择id =“annotationsSelect”> < /选择>< / div >< div id =“输出”=“vcenter push-right”> < / div >< div id =“serviceStatus”=“vcenter push-right”> < / div >< / div >< div=“docContainer”>< div=“sidepanel”id =“缩略图”> < / div >< div=“centerpanel”id =“观众”> < / div >< div=“sidepanel”id =“书签”> < / div >< / div >< / div >< /身体><脚本>窗口。onload = () = > {常量按钮= . getelementbyid (“exampleButton”);按钮。onclick = () = > {常量示例=window.examples.RotatePagesExample ();example.run ();}};> < /脚本< / html >
/ *删除默认的身体样式。集身体flex作为列;* /身体{保证金:0;显示:flex;flex-direction:列;}.container {保证金:10 px;宽度:钙(100% - 20 px);高度:calc vh - 20 px (100);}.toolbar {高度:5%;宽度:100%;边界底部:2 px固体# 333;flex-direction:行;显示:flex;}#{书签溢出:隐藏;}.vcenter {margin-top:汽车;margin-bottom:汽车;}.hcenter {margin-left:汽车;margin-right:汽车;}.push-right {margin-left: 10 px;}.docContainer {高度:95%;宽度:100%;显示:flex;flex-direction:行;}.sidepanel {宽度:15%;高度:100%;}.centerpanel {宽度:100%;高度:100%;}/ *风格元素模式。* /.lt-item .lt-image-border {/ *盒阴影(视图、项目、图像边界)* /不必:# 333 2 px 2 px 5 px 1 px;}.lt-view。lt-thumb-item {/ * * /保证金:5 px;填充:5 px;}.lt-item {* / / *项边界:2 px固体# 6 ecaab;background - color: # b2decf;填充:10 px;}.lt-image-border {/ * * /图像边界边界:3 px固体# 444;背景颜色:白色;}.lt-thumb-item {/ * * /缩略图项目边界:2 px固体# 6 ecaab;background - color: # b2decf;}.lt-thumb-item。lt-thumb-item-selected {/ * * /缩略图选择项边界:2 px固体# 59 b2ba;background - color: # 8 ce1e1;}.lt-thumb-item-hovered {* / / *徘徊缩略图项目边界:2 px固体# 52 b996;background - color: # 87 c7b1;}.small-modal {max-width: 200 px;宽度:200 px;}
需求< / div >目标平台
帮助21.0.2021.6.30版本< / div >< !--BEGIN Copyright notice--> 188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2021领先的技术公司。保留所有权利。< !--END Copyright notice-->
Leadtools.Document。查看器总成< / div >< div类="loading-spinner">
加载……< / div >< / div >< div id ="email-sent-container" class="hidden-group">

你的邮件已经发送到支持!有人应该联系!如果你的问题是紧急请回到聊天。

聊天时间:

周一——周五,上午6点等

谢谢你的反馈!

请填写表单重新开始一个新的聊天。

所有代理目前离线。

聊天时间:

周一-周五

早上8:30 - 6点

联系我们请填写这张表格,我们将通过电子邮件联系你。

名字是必需的。 姓是必需的。 需要有效的电子邮件(e。g example@example.com)。 问题不能为空。
支持销售许可< / div >
    上传…
    谢谢你的反馈!祝你有美好的一天!
    谈话已经结束。请填写以下调查!
    我的问题是解决了。
    这个字段是必需的。
    代理的技术知识< / div ><标签为="knowledge-rating" class="rating-group"> 这个字段是必需的。
    代理的沟通技巧< / div ><标签id ="communication-rating" class="rating-group"> 这个字段是必需的。
    188金宝搏的网址客服|支持|联系我们|知识产权的通知
    ©1991 - 2021领先的技术公司。保留所有权利。< !--END Copyright notice-->