帳票システム構築支援 uCosminexus EUR uCosminexus EUR Print Manager 帳票出力

[目次][用語][索引][前へ][次へ]

10.13.10 EUR Print Manager - Client Print ActiveX,またはEUR Print Manager - Client Preview ActiveXを自動でインストールして帳票を出力するときのコーディング例

最新のEUR Print Manager - Client Print ActiveX,またはEUR Print Manager - Client Preview ActiveXを自動でインストールして帳票を出力するときのコーディング例です。

クライアントPCに最新のEUR Print Manager - Client Print ActiveX,またはEUR Print Manager - Client Preview ActiveXがインストールされていない場合,クライアントPCの環境に応じてダウンロードパッケージが選択されて,自動でインストールされます。ユーザー単位インストールが可能な環境では,ユーザー単位インストール用のダウンロードパッケージが選択されます。それ以外の環境では,マシン単位インストール用のダウンロードパッケージが選択されます。

EUR Print Manager - Client Print ActiveX,またはEUR Print Manager - Client Preview ActiveXのインストールが完了すると,指定した帳票(EPF形式ファイル)がダウンロードされて,印刷またはプレビュー表示されます。

ダウンロードパッケージ:EUR Print Manager - Adapterのあるマシンに配置
EUR Print Manager - Client Print ActiveX(マシン単位用):
 http://xxx.xxx.xxx.xxx/machine/EURPMPrintAX.cab"
EUR Print Manager - Client Print ActiveX(ユーザー単位用):
 http://xxx.xxx.xxx.xxx/user/EURPMPrintAX.cab
EUR Print Manager - Client Preview ActiveX(マシン単位用):
 http://xxx.xxx.xxx.xxx/machine/EURPMPreViewAX.cab
EUR Print Manager - Client Preview ActiveX(ユーザー単位用):
 http://xxx.xxx.xxx.xxx/user/EURPMPreViewAX.cab
出力ファイル:EUR Print Manager - Adapterのあるマシンに配置
出力EPF形式ファイル名:http://xxx.xxx.xxx/File/EPF/sample.epf
<この項の構成>
(1) 帳票を印刷する場合
(2) 帳票をプレビュー表示する場合

(1) 帳票を印刷する場合

EUR Print Manager - Client Print ActiveXをインストールします。

<%@ page import="JP.co.Hitachi.soft.EURPM.*" %>
<%@ page contentType="text/html; charset=Shift_JIS" %>
<jsp:useBean id="adapter" class="JP.co.Hitachi.soft.EURPM.EURPMAdapterForJava" scope="session" />
<HTML>
<HEAD>
<TITLE>
EURPM-CL-AX JSP Sample
</TITLE>
<%
    //EURPM-CL-AXのバージョン取得
    String strVersion = adapter.getPrintAXVersion();
    //EURPM-CL-AXのクラスID取得
    String strClassID = adapter.getPrintAXClassID();
%>
<BODY>
<Script LANGUAGE="javascript">
<!--
    var CABType; // フラグ
    var CABPath; // CAB形式ファイルの格納場所
    var appVersion = window.navigator.appVersion.toLowerCase();
 
    // OSの判定
    // Windows XPの場合
    if ( (window.navigator.userAgent).indexOf( "NT 5.1" ) != -1 ) {
        CABType = 0;      //マシン単位インストールフラグ
    } else {              //上記以外の場合
        //ブラウザ判定
        //Internet Explorer 7の場合
        if (appVersion.indexOf("msie 7.0") > -1) {
            CABType = 0;  //マシン単位インストールフラグ
        } else {          //上記以外の場合
            CABType = 1;  //ユーザー単位インストール
        }
    }
    //フラグから使用するCAB形式ファイルを決定する
    if (CABType == 0) {
        //マシン単位インストールの格納場所の設定
        CabPath = "http://xxx.xxx.xxx.xxx/machine/EURPMPrintAX.cab";
    } else {
        //ユーザー単位インストールの格納場所の設定
        CabPath = "http://xxx.xxx.xxx.xxx/user/EURPMPrintAX.cab";
    }
 
    //OBJECTタグの記述
    document.write("<object");
    //Webサーバで取得したクラスIDを指定
    document.write(" classid=clsid:<%=strClassID%>");
    //CAB形式ファイルのパスおよびWebサーバで取得したバージョンを指定
    document.write(" codebase=" + CabPath + "#version=<%=strVersion%>");
    document.write(" ID=EURPMPRINTAX");
    document.write(" type=application/x-oleobject>");
    document.write("<BR>");
    document.write("<param name=EPFFileURL value=http://xxx.xxx.xxx/File/EPF/sample.epf>");
    document.write("<BR>");
    document.write("<param name=LogLevel value=16>");
    document.write("<BR>");
    document.write("</object>");
    document.write("<BR>");
-->
</Script>
</BODY>
</HTML>

(2) 帳票をプレビュー表示する場合

EUR Print Manager - Client Preview ActiveXをインストールします。

<%@ page import="JP.co.Hitachi.soft.EURPM.*" %>
<%@ page contentType="text/html; charset=Shift_JIS" %>
<jsp:useBean id="adapter" class="JP.co.Hitachi.soft.EURPM.EURPMAdapterForJava" scope="session" />
<HTML>
<HEAD>
<TITLE>
EURPM-CL-AX JSP Sample
</TITLE>
<%
    //EURPM-CL-PVXのバージョン取得
    String strVersion = adapter. getPreviewAXVersion();
    //EURPM-CL-PVXのクラスID取得
    String strClassID = adapter. getPreviewAXClassID();
%>
<BODY>
<Script LANGUAGE="javascript">
<!--
    var CABType; // フラグ
    var CABPath; // CAB形式ファイルの格納場所
    var appVersion = window.navigator.appVersion.toLowerCase();
 
    // OSの判定
    // Windows XPの場合
    if ( (window.navigator.userAgent).indexOf( "NT 5.1" ) != -1 ) {
        CABType = 0;      //マシン単位インストールフラグ
    } else {              //上記以外の場合
        //ブラウザ判定
        //Internet Explorer 7の場合
        if (appVersion.indexOf("msie 7.0") > -1) {
            CABType = 0;  //マシン単位インストールフラグ
        } else {          //上記以外の場合
            CABType = 1;  //ユーザー単位インストール
        }
    }
    //フラグから使用するCAB形式ファイルを決定する
    if (CABType == 0) {
        //マシン単位インストールの格納場所の設定
        CabPath = "http://xxx.xxx.xxx.xxx/machine/EURPMPreViewAX.cab";
    } else {
        //ユーザー単位インストールの格納場所の設定
        CabPath = "http://xxx.xxx.xxx.xxx/user/EURPMPreViewAX.cab";
    }
 
    //OBJECTタグの記述
    document.write("<object");
    //Webサーバで取得したクラスIDを指定
    document.write(" classid=clsid:<%=strClassID%>");
    //CAB形式ファイルのパスおよびWebサーバで取得したバージョンを指定
    document.write(" codebase=" + CabPath + "#version=<%=strVersion%>");
    document.write(" ID=EURPMPREVIEWAX");
    document.write(" width=500");
    document.write(" height=500");
    document.write(" type=application/x-oleobject>");
    document.write("<BR>");
    document.write("<param name=EPFFileURL value=http://xxx.xxx.xxx/File/EPF/sample.epf>");
    document.write("<BR>");
    document.write("<param name=LogLevel value=16>");
    document.write("<BR>");
    document.write("</object>");
    document.write("<BR>");
-->
</Script>
</BODY>
</HTML>