アプリ側でのビューア制御

ビューア―パラメータと関数・イベントを利用し、e-Formビューアを制御する方法について説明します。‌

‌OZビューアーの環境を設定します。主なパラメーターは以下の通りです。

例:

oz.sendToActionScript("information.debug", "true"); // ビューアコンソールの使用
oz.sendToActionScript("connection.reportname","/eform/membership-odiparam.ozr"); // レポート名の設定
oz.sendToActionScript("connection.inputjson", inputjson); // 入力コンポーネントの値を設定
oz.sendToActionScript("odi.odinames", "odiparam"); // odiファイル名
oz.sendToActionScript("comment.all", "true"); // enable highlighter on the viewer menubar
oz.sendToActionScript("viewer.progresscommand", "true"); // OZProgressCommandイベントを有効にする
oz.sendToActionScript("eform.signpad_type", "zoom"); // 署名のタイプを設定

ビューアを実行する際、使用する関数です。主な機能は以下の通りです。

例:レポートをPDFファイルとしてエクスポートする場合

// PDFとして保存
OZViewer.ScriptEx("save", "export.applyformat=pdf;pdf.filename=sample.pdf", ";"); 

ビューアの様々なイベントを取得し、それぞれのイベントにて、様々な機能を利用することができます。 主なイベントは以下の通りです。

例:入力イベントのすべてのステップをトレースします。

<script language="JavaScript">
function OZEFormInputEventCommand_OZViewer(docindex, formid, eventname, mainscreen) {
   if(eventname == "OnValueChanged") {
       alert(docindex + "," + formid); // do something you want
   }
}
</script>
</head>
<body style="width:98%;height:98%">
<div id="OZViewer" style="width:98%;height:98%"></div>
<script type="text/javascript" >
var serverUrl = "http://" + location.host + ":8080";
function SetOZParamters_OZViewer(){
    var oz = document.getElementById("OZViewer");
    oz.sendToActionScript("connection.servlet",serverUrl + "/oz/server");
    oz.sendToActionScript("connection.reportname","sample.ozr");
    oz.sendToActionScript("eform.inputeventcommand", "true");
    return true;
}
start_ozjs("OZViewer", serverUrl + "/oz/HTML5viewer/");
</script>

最終更新