123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
- xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
- <head>
- <title>在线查看文件</title>
- <script src="/api/jquery.min.js"></script>
- <script type="text/javascript">
- //打印
- function printWord(){
- $.ajax({
- url: "print.do",
- dataType: "json",
- type: "post",
- data: document.getElementById("printInfo").value,
- success: function(result) {
- $("#a1").attr('disabled',true);
- document.getElementById("PageOfficeCtrl1").PrintOut();
- },
- error: function(data) {
- alert("请求出错");
- }
- });
- }
-
- function AfterDocumentOpened() {
- document.getElementById("PageOfficeCtrl1").SaveAsReadOnly = true;
- document.getElementById("PageOfficeCtrl1").SetEnableFileCommand(3, false); // 禁止保存
- document.getElementById("PageOfficeCtrl1").SetEnableFileCommand(4, true); // 禁止另存
- document.getElementById("PageOfficeCtrl1").SetEnableFileCommand(5, true); //禁止打印
- document.getElementById("PageOfficeCtrl1").SetEnableFileCommand(6, true); // 禁止页面设置
- document.getElementById("PageOfficeCtrl1").SetEnableFileCommand(7, false); // 禁止属性
- document.getElementById("PageOfficeCtrl1").SetEnableFileCommand(8, true); // 禁止打印预览
- }
-
- function AfterDocumentOpenedPdf() {
- SetPageWidth();
- }
- function SetBookmarks() {
- document.getElementById("PageOfficeCtrl1").BookmarksVisible = !document.getElementById("PageOfficeCtrl1").BookmarksVisible;
- }
-
- function Print() {
- document.getElementById("PageOfficeCtrl1").ShowDialog(4);
- }
- function SwitchFullScreen() {
- document.getElementById("PageOfficeCtrl1").FullScreen = !document.getElementById("PageOfficeCtrl1").FullScreen;
- }
- function SetPageReal() {
- document.getElementById("PageOfficeCtrl1").SetPageFit(1);
- }
- function SetPageFit() {
- document.getElementById("PageOfficeCtrl1").SetPageFit(2);
- }
- function SetPageWidth() {
- document.getElementById("PageOfficeCtrl1").SetPageFit(3);
- }
- function ZoomIn() {
- document.getElementById("PageOfficeCtrl1").ZoomIn();
- }
- function ZoomOut() {
- document.getElementById("PageOfficeCtrl1").ZoomOut();
- }
- function FirstPage() {
- document.getElementById("PageOfficeCtrl1").GoToFirstPage();
- }
- function PreviousPage() {
- document.getElementById("PageOfficeCtrl1").GoToPreviousPage();
- }
- function NextPage() {
- document.getElementById("PageOfficeCtrl1").GoToNextPage();
- }
- function LastPage() {
- document.getElementById("PageOfficeCtrl1").GoToLastPage();
- }
- function RotateRight() {
- document.getElementById("PageOfficeCtrl1").RotateRight();
- }
- function RotateLeft() {
- document.getElementById("PageOfficeCtrl1").RotateLeft();
- }
-
- function Save() {
- document.getElementById("PageOfficeCtrl1").WebSave();
- }
-
- //文档关闭前先提示用户是否保存
- function BeforeBrowserClosed() {
- if (document.getElementById("PageOfficeCtrl1").IsDirty) {
- if (confirm("提示:文档已被修改,是否继续关闭放弃保存 ?")) {
- return true;
- } else {
- return false;
- }
- }
- }
- </script>
- </head>
- <body>
- <div style="width:auto;height:700px;" th:utext="${pageoffice}"></div>
- <input id="printInfo" name="printInfo" type="hidden" th:value="${printInfo}">
- <footer style="margin:auto;" th:if="${printInfo !=null && printInfo !='' }">
- <div style="width:100px;margin-left:auto;margin-right:auto;">
- <button style="width:80px;height:40px" id="a1" onclick="printWord()">打印</button>
- </div>
- </footer>
- </body>
- </html>
|