<%@ page language="java"
	import="java.util.*,com.zhuozhengsoft.pageoffice.*"
	pageEncoding="gb2312"%>
<%@ taglib uri="http://java.pageoffice.cn" prefix="po"%>
<%
	//******************************卓正PageOffice组件的使用*******************************
	PageOfficeCtrl poCtrl1 = new PageOfficeCtrl(request);
	poCtrl1.setServerPage(request.getContextPath()+"/poserver.zz"); //此行必须
	//隐藏菜单栏
	poCtrl1.setMenubar(false);
	//添加自定义按钮
	poCtrl1.addCustomToolButton("保存","Save()",1);
	poCtrl1.addCustomToolButton("开始手写", "StartHandDraw()", 5);
	poCtrl1.addCustomToolButton("设置线宽", "SetPenWidth()", 5);
	poCtrl1.addCustomToolButton("设置颜色", "SetPenColor()", 5);
	poCtrl1.addCustomToolButton("设置笔型", "SetPenType()", 5);
	poCtrl1.addCustomToolButton("设置缩放", "SetPenZoom()", 5);
	poCtrl1.addCustomToolButton("访问手写集", "GetHandDrawList()", 6);

	poCtrl1.setSaveFilePage("SaveFile.jsp");
	poCtrl1.webOpen("doc/template.doc", OpenModeType.docNormalEdit, "张三");
	poCtrl1.setTagId("PageOfficeCtrl1"); //此行必须
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title></title>

		<script language="JavaScript">
		//保存
		function Save() {
            document.getElementById("PageOfficeCtrl1").WebSave();
        }
        //开始手写
        function StartHandDraw() {
            document.getElementById("PageOfficeCtrl1").HandDraw.Start();
        }
        //设置线宽
        function SetPenWidth() {
            document.getElementById("PageOfficeCtrl1").HandDraw.SetPenWidth(5);
        }
        //设置颜色
        function SetPenColor() {

            document.getElementById("PageOfficeCtrl1").HandDraw.SetPenColor(5292104);
        }
        //设置笔型
        function SetPenType() {

            document.getElementById("PageOfficeCtrl1").HandDraw.SetPenType(1);
        }
        //设置缩放
        function SetPenZoom() {

            document.getElementById("PageOfficeCtrl1").HandDraw.SetPenZoom(50);
        }
        //撤销最近一次手写
        function UndoHandDraw() {

            document.getElementById("PageOfficeCtrl1").HandDraw.Undo();
        }
        //退出手写
        function ExitHandDraw() {

            document.getElementById("PageOfficeCtrl1").HandDraw.Exit();
        }
        //访问手写集合
        function GetHandDrawList() {

            var handDrawList = null;
            var handDraw = null;
            handDrawList = document.getElementById("PageOfficeCtrl1").HandDraw;
            alert("本文档共有 " + handDrawList.Count + " 个手写批示。");
            var i = 0; //索引从0开始
            for (i = 0; i < handDrawList.Count; i++) {
                handDraw = handDrawList.Item(i);
                handDraw.Locate();
                alert("第" + handDraw.PageNumber + "页" + ", " + handDraw.UserName + ", " + handDraw.DateTime);
            }
        }
    </script>

	</head>
	<body>
		<div
			style="font-size: 12px; line-height: 20px; border-bottom: dotted 1px #ccc; border-top: dotted 1px #ccc; padding: 5px;">
			<span style="color: red;">操作说明：</span>若想提前设置线宽、颜色、笔型、缩放等，可先点击自定义工具栏上的相应按钮，然后点击“开始手写”按钮。在尚未关闭手写工具栏时，点“撤销最近一次手写”按钮，可撤销最近一次的手写；点击“退出手写”按钮，可退出手写；还可点“设置线宽”、“设置颜色”等按钮对手写批注的颜色、线宽等进行再次设置。
			<br />
			关键代码：点右键，选择“查看源文件”，看js函数
			<br />
			<input id="Button3" type="button" value="设置线宽"
				onclick="SetPenWidth()" />
			<input id="Button4" type="button" onclick="SetPenColor()"
				value="设置颜色" />
			<input id="Button1" type="button" value="撤销最近一次手写"
				onclick="UndoHandDraw()" />
			<input id="Button2" type="button" onclick="ExitHandDraw()"
				value="退出手写" />
			<span style="background-color: Yellow;"></span>
		</div>
		<br />
		<form id="form1">
			<div style="height: 700px; width: auto;">
				<po:PageOfficeCtrl id="PageOfficeCtrl1">
				</po:PageOfficeCtrl>
			</div>
		</form>
	</body>
</html>
