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

## ‌:ballot\_box\_with\_check: ビューアオプションパラメータ

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

| パラメータ       | 説明                       |
| ----------- | ------------------------ |
| connection  | OZサーバへの接続とレポートバインディングを設定 |
| information | ロギングオプション                |
| eform       | e-Formの属性                |
| odi         | ODIオプション                 |
| toolbar     | ビューアのツールバーオプション          |
| comment     | コメントモードのオプション            |
| viewer      | e-Form制御のためのビューア属性       |

例：

```javascript
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"); // 署名のタイプを設定
```

## ‌:ballot\_box\_with\_check: ビューア関数

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

| 機能                      | 説明                      |
| ----------------------- | ----------------------- |
| CreateReport            | レポートの生成                 |
| GetInformation          | レポートについての情報の取得          |
| GetMemoryStreamByExport | レポートをメモリーストリーム文書にエクスポート |
| Script、ScriptEx         | ビューアメニューとツールバーの機能を実行    |
| TriggerExternalEvent    | e-Formのトリガーイベント         |

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

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

## ​:ballot\_box\_with\_check: ビューアのイベント

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

| 機能                       | 説明                                                               |
| ------------------------ | ---------------------------------------------------------------- |
| OZEFormInputEventCommand | <p>入力コンポーネントを使用する場合発生するイベント</p><p>（OnClick、OnValueChangedなど）</p> |
| OZErrorCommand           | エラーの発生後に発生するイベント                                                 |
| OZExportCommand          | レポートを保存した後に発生するイベント                                              |
| OZProgressCommand        | レポートの作成時に発生するイベント                                                |
| OZExitCommand            | OZビューアーを閉じた後に発生するイベント                                            |

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

```javascript
<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>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jp.ozeform.io/bjonbakkuappu/oz-viewer-study/apuridenobya.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
