JP2015225481A - Program for efficiently editing print setting information - Google Patents

Program for efficiently editing print setting information Download PDF

Info

Publication number
JP2015225481A
JP2015225481A JP2014109630A JP2014109630A JP2015225481A JP 2015225481 A JP2015225481 A JP 2015225481A JP 2014109630 A JP2014109630 A JP 2014109630A JP 2014109630 A JP2014109630 A JP 2014109630A JP 2015225481 A JP2015225481 A JP 2015225481A
Authority
JP
Japan
Prior art keywords
var
print setting
print
information
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2014109630A
Other languages
Japanese (ja)
Inventor
鈴木 慎也
Shinya Suzuki
慎也 鈴木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2014109630A priority Critical patent/JP2015225481A/en
Publication of JP2015225481A publication Critical patent/JP2015225481A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide means for efficiently editing print setting information even for a large amount of print setting items in a print setting editing module provided by a V4 driver.SOLUTION: In a print setting editing module, data maintaining model dependence information is used to efficiently performing print setting editing, thereby deterioration of performance is suppressed.

Description

本発明は、新しいアーキテクチャにおけるプリンタードライバーの印刷設定処理を行うプログラムに関する。   The present invention relates to a program for performing print setting processing of a printer driver in a new architecture.

Microsoft社のWindows(登録商標)8では、V4プリンタードライバーと呼ばれる新しいアーキテクチャで動作するプリンタードライバーが導入された。V4プリンタードライバーは、V3プリンタードライバーのアーキテクチャとして提供されていたXPS(XML Paper Specification)プリンタードライバーの後継となるアーキテクチャであり、XPSドキュメントを利用した印刷パスを利用している。   In Windows (registered trademark) 8 of Microsoft Corporation, a printer driver that operates with a new architecture called a V4 printer driver was introduced. The V4 printer driver is an architecture succeeding the XPS (XML Paper Specification) printer driver provided as the architecture of the V3 printer driver, and uses a print path using an XPS document.

このXPS印刷パスにおいて、印刷物の体裁を決定するために利用されるものがPrintCapabilitiesと呼ばれるXML形式で記述された印刷機能情報と、PrintTicketと呼ばれるXML形式で記述された印刷設定情報である。V4プリンタードライバーは、このPrintCapabilitiesやPrintTicketを生成するために、GPD(Generic Printer Description)と呼ばれる印刷設定定義ファイルを記載し、ユーザーに対して印刷設定変更機能を提供することができる(非特許文献1)。   In this XPS printing pass, what is used to determine the appearance of the printed material is print function information described in an XML format called PrintCapabilities and print setting information described in an XML format called PrintTicket. In order to generate PrintCapabilities and PrintTicket, the V4 printer driver describes a print setting definition file called GPD (Generic Printer Description) and can provide a user with a print setting change function (Non-Patent Document 1). ).

ただし、上記のGPDではユーザーが印刷設定できる選択肢を定義するにとどまり、数値や文字列を定義することができない。たとえば余白設定をユーザーが行う場合、余白設定の機能を有効にする・有効にしないという選択肢を提供することができるが、実際にどれくらいの余白値(数値)を設定するかを定義することができない。そのため、OS(Operationg System)はGPDからPrintCapabilitiesやPrintTicketを生成する機能を持つコンフィグモジュールに、PrintCapabilitiesの修正やPrintTicketを精査するための拡張モジュールを取り入れる機構を用意している。プリンタードライバー開発ベンダーは、この拡張モジュールである印刷設定変更モジュールを実装することで数値や文字列等のパラメータに関する定義を追加することができる(非特許文献2)。   However, the above GPD only defines options that the user can set for printing, and cannot define numerical values or character strings. For example, when the user performs margin setting, it can provide an option to enable / disable the margin setting function, but it is not possible to define how much margin value (numerical value) is actually set. . Therefore, the OS (Operation System) provides a mechanism that incorporates an extension module for modifying PrintCapabilities and examining PrintTickets into a configuration module having a function for generating PrintCapabilities and PrintTickets from GPD. Printer driver development vendors can add definitions related to parameters such as numerical values and character strings by installing a print setting change module, which is an extension module (Non-patent Document 2).

「PrintTicket and PrintCapabilities Support in Windows Print Drivers」(URL: http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/XPSDrv_PrintTicket.doc)"PrintTicket and PrintCapabilities Support in Windows Print Drivers" (URL: http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/XPSDrv_PrintTicket.doc) 「Developing v4 Print Drivers v1.3」(URL: http://download.microsoft.com/download/1/D/8/1D84C319-0082-4DEB-8708-856EF3CE21C7/developing-v4-print-drivers.docx)`` Developing v4 Print Drivers v1.3 '' (URL: http://download.microsoft.com/download/1/D/8/1D84C319-0082-4DEB-8708-856EF3CE21C7/developing-v4-print-drivers.docx)

ところで、たくさんの機能を有する複合機に対する印刷設定の項目は膨大であり、巨大な印刷設定情報となることが想定される。さらに、数値や文字列を指定する印刷設定項目も膨大になることが想定され、印刷設定変更モジュールの処理が印刷処理のパフォーマンスに大きな影響を与えることが判明している。このように、V3ドライバーでは発生しなかった印刷設定編集処理が導入されたことにより、パフォーマンスの低下を及ぼしている。   By the way, the number of print setting items for a multi-function peripheral having many functions is enormous, and it is assumed that the print setting information is enormous. Further, it is assumed that the number of print setting items for designating numerical values and character strings is enormous, and it has been found that the process of the print setting change module has a great influence on the performance of the print process. In this way, the introduction of the print setting editing process that did not occur in the V3 driver has caused a decrease in performance.

本発明は、上記の課題を鑑みてなされたものである。即ち、印刷設定編集処理におけるプログラムにおいて、より効率的な印刷設定情報の編集手段を提供することを目的とする。   The present invention has been made in view of the above problems. That is, it is an object of the present invention to provide more efficient print setting information editing means in a program for print setting editing processing.

本発明は、
XML形式で記述された印刷設定能力情報および印刷設定情報を用いた印刷設定変更機能を有するプリンタードライバーが提供する印刷設定編集モジュールにおいて、
機種依存情報を保持しているデータファイルからパラメータ情報を取得する手段と、
パラメータ情報を利用して、印刷設定能力情報および印刷設定情報を編集する手段と、
ユーザーが設定した印刷設定に応じて、印刷設定能力情報および印刷設定情報を編集する手段と、
印刷設定情報の値をDEVMODEに登録する手段と、
DEVMODEに登録された値を印刷設定情報に反映する手段を有し、
これらの処理を膨大な印刷設定情報においても効率的に行うことを特徴とするプログラムである。
The present invention
In the print setting editing module provided by the printer driver having the print setting capability information described in the XML format and the print setting changing function using the print setting information,
Means for obtaining parameter information from a data file holding model-dependent information;
Means for editing print setting capability information and print setting information using parameter information;
A means for editing the print setting capability information and the print setting information according to the print settings set by the user;
Means for registering the value of the print setting information in DEVMODE;
Means for reflecting the value registered in DEVMODE in the print setting information;
This program is characterized in that these processes are efficiently performed even with a large amount of print setting information.

本発明により、効率的な印刷設定編集処理を行うことができ、膨大な機能を持った印刷設定編集処理におけるパフォーマンスが向上する。そのため、ユーザーが行う印刷設定変更処理や印刷にかかる時間を減少することができる。   According to the present invention, efficient print setting editing processing can be performed, and the performance in the print setting editing processing having a huge function is improved. Therefore, it is possible to reduce the print setting change process performed by the user and the time required for printing.

本発明の一実施形態としての、コンピューターシステムのハードウェアとソフトウェアのブロック構成図である。It is a block block diagram of the hardware and software of a computer system as one Embodiment of this invention. 本発明の一実施形態としての、印刷処理システムのブロック構成図である。1 is a block configuration diagram of a print processing system as an embodiment of the present invention. FIG. 本発明の一実施形態としての、ドライバー印刷処理システムで使用される印刷設定であるXML形式のPrintCapabilitesの一例である。6 is an example of an XML format PrintCapabilities that is a print setting used in a driver print processing system according to an embodiment of the present invention. 本発明の一実施形態としての、ドライバー印刷処理システムで使用される印刷設定であるXML形式のPrintTicketの一例である。6 is an example of an XML format PrintTicket that is a print setting used in a driver print processing system according to an embodiment of the present invention. 本発明の一実施形態としての、DriverPropertyBagに保存されている、機種依存情報としてのJSONデータの一例である。It is an example of the JSON data as model dependence information preserve | saved at DriverPropertyBag as one Embodiment of this invention. 本発明の一実施形態としての、XML形式で記載されたDEVMODEに関する定義データの一例である。It is an example of the definition data regarding DEVMODE described in the XML format as one embodiment of the present invention.

以下、本発明を実施するための最良の形態について図面を用いて説明する。図1は本発明の実施形態を示す一般的なコンピューターを用いたシステムのブロック構成図である。   The best mode for carrying out the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram of a system using a general computer showing an embodiment of the present invention.

CPU101は主記憶装置102のROM1021あるいはRAM1022あるいは補助記憶装置105に格納されたプログラムに従って装置全体の制御を行う。RAM1022はCPU101が各種処理を行う際のワークエリアとしても使用される。本実施形態における各コンポーネントの処理はすべてRAM102に読み込んで動作する。補助記憶装置105はアプリケーション1051やプリンタードライバー1052、オペレーティングシステム(OS)1053等を記録する。プリンタードライバー1052は、印刷機能を持つデバイスに対して、印刷指示を行うことができる。キーボード1031やマウス・タッチパネルなどに代表されるポインティングデバイス1032などの入力機器は、入力I/F103を通じて、ユーザーがコンピューターに対して各種指示を与えるためのデバイスである。出力I/F104は、データを外部に出力するためのインターフェースであり、モニタ1041やプリンター1042などの出力機器に対してデータを出力する。プリンター1042とは直接接続されるローカルI/Oのみならず、通信I/F106を通じて接続されるネットワーク1061を通して接続されていてもよい。また、107は共通データシステムバスで、I/Fやモジュール間でデータのやりとりを行う。   The CPU 101 controls the entire apparatus according to a program stored in the ROM 1021 or the RAM 1022 of the main storage device 102 or the auxiliary storage device 105. The RAM 1022 is also used as a work area when the CPU 101 performs various processes. All the processing of each component in this embodiment is read into the RAM 102 and operates. The auxiliary storage device 105 records an application 1051, a printer driver 1052, an operating system (OS) 1053, and the like. The printer driver 1052 can issue a print instruction to a device having a print function. An input device such as a pointing device 1032 typified by a keyboard 1031 and a mouse / touch panel is a device for the user to give various instructions to the computer through the input I / F 103. The output I / F 104 is an interface for outputting data to the outside, and outputs data to an output device such as a monitor 1041 or a printer 1042. The printer 1042 may be connected not only through the local I / O directly connected but also through the network 1061 connected through the communication I / F 106. Reference numeral 107 denotes a common data system bus, which exchanges data between I / Fs and modules.

図2はドライバー印刷システムのブロック構成図である。ドライバー印刷システムはXPSファイルフォーマットをスプールデータとして使用し、印刷を行うシステムである。ドライバー印刷システムは、オペレーティングシステム1053上で動作している。プリントマネージャ218、GDItoXPS変換モジュール207、フィルタパイプラインマネージャ212、ポートモニター219はオペレーティングシステム1053に含まれるモジュールである。GDIとはプリンターの印刷イメージの生成を行うグラフィックスコンポーネントであり、GDItoXPS変換モジュール207は、GDIで描画されたデータをXPSデータへ変換する機能を持つ。   FIG. 2 is a block diagram of the driver printing system. The driver printing system is a system that performs printing using the XPS file format as spool data. The driver printing system operates on the operating system 1053. The print manager 218, the GDI to XPS conversion module 207, the filter pipeline manager 212, and the port monitor 219 are modules included in the operating system 1053. GDI is a graphics component that generates a print image of a printer. The GDI to XPS conversion module 207 has a function of converting data drawn in GDI into XPS data.

フィルタパイプラインマネージャ212は、XPS印刷パスの特徴であるフィルタ印刷処理の管理を行うモジュールである。ポートモニター219は、デバイスにアクセスするプリントマネージャ208とプリンタードライバー間で通信を制御することができプリンタードライバーはポートモニター219を経由して印刷処理を行う。GDItoXPS変換モジュール207、コンフィグレーションモジュール208、フィルタパイプラインマネージャ212は、プリンタードライバー1052に含まれているが、オペレーティングシステム1053から提供されているプリンタードライバー1052のモジュールという位置づけである。コンフィグレーションモジュール208は、プリンタードライバーが提供する印刷設定編集モジュール2081を使用して印刷設定情報を編集することができ、印刷設定編集モジュール2081は、プリンタードライバーが提供するプロパティバッグ2082を利用して印刷設定情報を編集する。プロパティバッグ2082とは、機種依存情報や印刷キューに紐づいた情報等のデータが保持された領域を指す。   The filter pipeline manager 212 is a module that manages filter print processing, which is a feature of the XPS print path. The port monitor 219 can control communication between the print manager 208 accessing the device and the printer driver, and the printer driver performs print processing via the port monitor 219. The GDI to XPS conversion module 207, the configuration module 208, and the filter pipeline manager 212 are included in the printer driver 1052, but are positioned as modules of the printer driver 1052 provided from the operating system 1053. The configuration module 208 can edit the print setting information using the print setting editing module 2081 provided by the printer driver. The print setting editing module 2081 prints using the property bag 2082 provided by the printer driver. Edit the setting information. The property bag 2082 indicates an area in which data such as model-dependent information and information associated with a print queue is held.

プリンタードライバー1052とフィルタパイプラインマネージャ212の各フィルタは、図1の補助記憶装置105にプリンタードライバー1052として格納されている。GDI印刷アプリケーション201とXPS印刷アプリケーション202は、図1の補助記憶装置105にアプリケーション1051として格納されている。ユーザーはキーボード1031やタッチパネル/マウスなどに代表されるポインティングデバイス1032などといった入力装置を使用して、出力装置のモニタ1041に映し出されたGDI印刷アプリケーション201(以下、GDIアプリと略す)、もしくはXPS印刷アプリケーションプログラム202(以下、XPSアプリと略す)から印刷処理を実行する。印刷処理はプリンターの選択、印刷設定の作成、描画データの変換と3つの処理を順番に行うことで実行する。   Each filter of the printer driver 1052 and the filter pipeline manager 212 is stored as the printer driver 1052 in the auxiliary storage device 105 of FIG. The GDI printing application 201 and the XPS printing application 202 are stored as applications 1051 in the auxiliary storage device 105 of FIG. A user uses an input device such as a keyboard 1031 or a pointing device 1032 typified by a touch panel / mouse to display a GDI print application 201 (hereinafter abbreviated as GDI application) displayed on the monitor 1041 of the output device or XPS printing. Print processing is executed from an application program 202 (hereinafter abbreviated as XPS application). The print process is executed by sequentially performing three processes, ie, printer selection, print setting creation, and drawing data conversion.

まずは、印刷したいプリンター1042の選択をする。ユーザーから見るとプリンター1042の選択は、印刷を実行するプリンター1042に対応したプリンタードライバー1052を選択することと同義である。1052の選択には、プリントキューを利用する。   First, the printer 1042 to be printed is selected. From the viewpoint of the user, selecting the printer 1042 is synonymous with selecting the printer driver 1052 corresponding to the printer 1042 that executes printing. A print queue is used to select 1052.

次に印刷設定を作成する。印刷設定はまず、アプリケーション1051が印刷設定用のメモリ領域をRAM1022に確保する。そして、アプリケーション1051は、プリンタードライバー1052のコンフィギュレーションモジュール204を呼び出して、印刷設定データを作成して格納する。GDIアプリ201では印刷設定データとしてバイナリのDEVMODE構造体203を用い、XPSアプリ202ではマークアップ言語のXMLで記載されたPrintTicket204を用いる。DEVMODE構造体203は、オペレーティングシステムが定義する標準領域とプリンタードライバーが独自で定義する拡張領域を持つ。PrintTicket204は、XML形式で記述された印刷設定情報で、標準領域と拡張領域は名前空間によって記載が分かれている。印刷設定データには機種固有の情報も含まれているので、コンフィギュレーションモジュール208は、機種依存ファイル209を利用して、印刷設定データを作成する。このDEVMODE構造体203もしくはPrintTicket204が印刷設定を保持しており、アプリケーションが直接、値を書き換えることで印刷設定を変更する。プリンター1042に依存した専用の設定は、プリンターエクステンション210が持つユーザーインターフェースで設定する。   Next, print settings are created. For print setting, first, the application 1051 secures a memory area for print setting in the RAM 1022. Then, the application 1051 calls the configuration module 204 of the printer driver 1052 to create and store print setting data. The GDI application 201 uses a binary DEVMODE structure 203 as print setting data, and the XPS application 202 uses a PrintTicket 204 written in markup language XML. The DEVMODE structure 203 has a standard area defined by the operating system and an extended area uniquely defined by the printer driver. PrintTicket 204 is print setting information described in the XML format, and the description of the standard area and the extended area is divided according to the name space. Since the print setting data includes model-specific information, the configuration module 208 uses the model-dependent file 209 to create print setting data. The DEVMODE structure 203 or the PrintTicket 204 holds the print setting, and the application changes the print setting by directly rewriting the value. Dedicated settings depending on the printer 1042 are set by a user interface of the printer extension 210.

プリンターエクステンション210は、プリンタードライバー1052の一種ではあるが、別のアプリケーションとしてインストールを行う。プリンタードライバー1052は、ユーザーインターフェースの設定に従い、DEVMODE構造体203もしくはPrintTicket204のプリンター1042に依存した設定を変更する。印刷設定とは具体的に、出力する用紙サイズを「A4」にする、印刷の向きを「横」にする、など印刷を行うのに必要なデータのことを指す。PrintTicket204は印刷設定がXML形式で記述されているので、XPSアプリ202がすべての設定値を直接変更して書き換えることは容易だが、プリンターエクステンション210のユーザーインターフェースを使って設定変更してもかまわない。印刷設定は文書印刷のたびに作成するが、プリンター1042のオプション機器や、ユーザーごとの環境設定など設定を保持しておきたいものは、ユーザーインターフェースがオペレーティングシステムのレジストリデータベース205に保存する。レジストリデータベース205が使用できないときは、ユーザーインターフェースは、アプリケーションデータ220に設定を保存する。印刷設定のデフォルト値はオペレーティングシステムのプリントマネージャ218が、レジストリデータベース205に保存する。レジストリデータベース205や、アプリケーションデータ220は、補助記憶装置105に保存される。最後に描画データの変換を行う。印刷設定が確定したら、ユーザーはアプリケーションから印刷処理を実行する。GDIアプリ201から印刷する場合は、プリンタードライバーの形態を取るGDItoXPS変換モジュール207に描画データが送られ、XPSスプールファイル206が作成される。このときGDItoXPS変換モジュール207はコンフィギュレーションモジュール208を呼び出し、印刷設定をDEVMODE構造体203からPrintTicket204に変換する。変換する際には、印刷設定編集モジュール2081が使用される。XPSアプリ202から印刷する場合は、XPSファイルをXPSアプリ自身が生成するのと、オペレーティングシステムがXPSアプリからの描画命令に応じてXPSファイルを生成するのと2通りの方法がある。どちらの方法であっても、印刷の途中でXPSスプールファイル206を生成する。   The printer extension 210 is a kind of the printer driver 1052, but is installed as another application. The printer driver 1052 changes the setting depending on the printer 1042 of the DEVMODE structure 203 or the PrintTicket 204 according to the setting of the user interface. Specifically, the print setting refers to data necessary for printing such as “A4” for the output paper size and “landscape” for the print orientation. Since the print settings of the PrintTicket 204 are described in the XML format, it is easy for the XPS application 202 to directly change and rewrite all the setting values. However, the setting may be changed using the user interface of the printer extension 210. The print settings are created every time a document is printed, but the user interface stores settings such as optional devices of the printer 1042 and environment settings for each user in the registry database 205 of the operating system. When the registry database 205 cannot be used, the user interface stores settings in the application data 220. The default value of the print setting is stored in the registry database 205 by the print manager 218 of the operating system. The registry database 205 and application data 220 are stored in the auxiliary storage device 105. Finally, drawing data is converted. When the print settings are determined, the user executes print processing from the application. When printing from the GDI application 201, drawing data is sent to the GDI to XPS conversion module 207 in the form of a printer driver, and an XPS spool file 206 is created. At this time, the GDI to XPS conversion module 207 calls the configuration module 208 to convert the print setting from the DEVMODE structure 203 to the PrintTicket 204. At the time of conversion, a print setting editing module 2081 is used. When printing from the XPS application 202, there are two methods: an XPS file is generated by the XPS application itself, and an XPS file is generated by the operating system in response to a drawing command from the XPS application. In either method, the XPS spool file 206 is generated during printing.

XPSスプールファイル206が生成されたら、プリントフィルタパイプライン211に処理が渡される。プリントフィルタパイプライン211は複数のフィルタを通すことで印刷が行われる仕組みで、フィルタコンフィギュレーションファイル216でフィルタの数や順番を制御する。プリントフィルタパイプライン211で動作するフィルタパイプラインマネージャ212はフィルタコンフィギュレーションファイル216に従って、この実施例では通信フィルタ213、レイアウトフィルタ214、レンダラフィルタ215の順に処理を行う。フィルタはプリンタードライバー1052の構成によって、数や種類が異なる。印刷処理はXPSスプールファイル206をフィルタに受け渡すことで行われ、フィルタがそれぞれXPSスプールファイル206を加工し次のフィルタに渡していくことで処理が進む。通信フィルタ213は、プリントマネージャ218およびポートモニターを経由してプリンター1042と通信する機能と、直接プリンター1042と通信する機能を持つ。レイアウトフィルタ214は、倍率の変更や製本の面付けレイアウトやスタンプなどレイアウトに関する処理を行う。レンダラフィルタ215では、XPSスプールファイル206をレンダリングしてPDLに変換する。PDLデータは印刷処理のスケジュール管理を行うプリントマネージャ218で管理され、キュー(待ち行列)に印刷ジョブが次々と登録される。プリンター1042が印刷できる状態になったら、キューに登録した順にポートモニター219を通して送信する。このようにして、アプリケーションからの印刷データをPDLデータに変換することがプリンタードライバーの主な役目であり、印刷処理が行われる。   When the XPS spool file 206 is generated, the process is passed to the print filter pipeline 211. The print filter pipeline 211 is a mechanism in which printing is performed by passing a plurality of filters. The filter configuration file 216 controls the number and order of the filters. In this embodiment, the filter pipeline manager 212 operating in the print filter pipeline 211 performs processing in the order of the communication filter 213, the layout filter 214, and the renderer filter 215 in accordance with the filter configuration file 216. The number and type of filters differ depending on the configuration of the printer driver 1052. The printing process is performed by passing the XPS spool file 206 to the filter, and the process proceeds when the filter processes the XPS spool file 206 and passes it to the next filter. The communication filter 213 has a function of communicating with the printer 1042 via the print manager 218 and the port monitor, and a function of directly communicating with the printer 1042. The layout filter 214 performs layout-related processing such as magnification change, bookbinding imposition layout, and stamp. The renderer filter 215 renders the XPS spool file 206 and converts it into PDL. The PDL data is managed by a print manager 218 that manages a print processing schedule, and print jobs are successively registered in a queue (queue). When the printer 1042 is ready to print, it transmits through the port monitor 219 in the order registered in the queue. In this way, conversion of print data from the application into PDL data is the main role of the printer driver, and print processing is performed.

ここで、プリンタードライバーが利用する印刷設定情報のPrintCapabilitiesおよびPrintTicketについて図3、図4を用いて説明する。図3は、PrintCapabilitiesの一部を抜粋した図である。PrintCapabilitiesでは、印刷設定として設定可能な選択肢の値がXML形式で記述されている。具体的には、Feature内に書かれているOptionの項目が選択肢としてユーザーに提供される。また、ParameterDefには、数値や文字列等のパラメータに関する定義が記載されている。図4は、PrintTicketの一部を抜粋した図である。上記のPrintCapabilitiesの項目から、ユーザーが実際に選択した印刷設定が記載される。数値や文字列を示すParameterに関しては、ParameterInitに記載される。   Here, PrintCapabilities and PrintTicket of print setting information used by the printer driver will be described with reference to FIGS. FIG. 3 is an excerpt of a part of PrintCapabilities. In PrintCapabilities, option values that can be set as print settings are described in XML format. Specifically, an Option item written in the Feature is provided to the user as an option. Also, ParameterDef describes definitions related to parameters such as numerical values and character strings. FIG. 4 is an extracted part of the PrintTicket. The print settings actually selected by the user from the above-mentioned PrintCapabilities items are described. A Parameter indicating a numerical value or a character string is described in ParameterInit.

次に、印刷設定編集モジュール2081の処理について説明する。本実施形態では、印刷設定編集モジュール2081がJavaScript(登録商標)言語で記述されていることを想定している。印刷設定編集モジュール2081は、以下のI/Fを持ち、OSのコンフィグレーションモジュール208から呼び出される。
・completePrintCapabilities
・convertDevmodeToPrintTicket
・convertPrintTicketToDevmode
・validatePrintTicket
プリンター開発ベンダーは各I/Fにおいて、コンフィグレーションモジュール208から呼び出された際の処理を実装することができる。各I/Fから呼び出された場合、PrintCapabilitiesやPrintTicket、プロパティバッグ2082へのアクセスI/Fを受け取ることができ、これらを利用してPrintCapabilitiesおよびPrintTicketの編集を行う。
Next, processing of the print setting editing module 2081 will be described. In the present embodiment, it is assumed that the print setting editing module 2081 is written in the JavaScript (registered trademark) language. The print setting editing module 2081 has the following I / F and is called from the OS configuration module 208.
・ CompletePrintCapabilities
ConvertDevmodeToPrintTicket
-ConvertPrintTicketToDevmode
-ValidatePrintTicket
The printer development vendor can implement processing when called from the configuration module 208 in each I / F. When called from each I / F, an access I / F to the PrintCapabilities, the PrintTicket, and the property bag 2082 can be received, and the PrintCapabilities and the PrintTicket are edited using these.

以下、各I/Fの処理についてソースコードを用いて説明する。
・completePrintCapabilities
本関数では、PrintCapabilitiesの生成時や修正する必要がある場合に呼び出される関数である。本実施形態では、主に以下の機能を説明する。
Hereinafter, processing of each I / F will be described using source code.
・ CompletePrintCapabilities
This function is a function that is called when PrintCapabilities are generated or needs to be corrected. In the present embodiment, the following functions are mainly described.

− ParameterDefの追加
− ParameterRefの追加
− SubFeatureへの変換
− 余白設定を行った際の有効印字領域の編集
以下に、ParameterDefの追加から順に処理内容を説明する。
-Addition of ParameterDef-Addition of ParameterRef-Conversion to SubFeature-Editing of effective print area when margin is set The following describes the processing contents in order from the addition of ParameterDef.

まず、competePrintCapabilitesの関数が呼ばれると、印刷設定編集モジュール2801は、OSから受けとったプロパティバッグ2082へアクセスするためのオブジェクトを生成する。本実施形態では、ドライバーが対応する機種の情報が保存されたDriverPropertyBagへアクセスするためのオブジェクトを用意する。   First, when a function of printPrintCapabilities is called, the print setting editing module 2801 generates an object for accessing the property bag 2082 received from the OS. In the present embodiment, an object for accessing the DriverPropertyBag in which the information on the model supported by the driver is stored is prepared.

本実施形態で示すDriverPropertyBagとは、機種依存情報が定義されたデータ群のことを指し、図5のようなJSON(JavaScript Object Notation)と呼ばれる形式の文字列を保持することとする。JSONは、JavaScriptが利用しやすいデータ形式であり、DriverPropertyBagの定義に沿った形で定義されているものとする。以下、これらのデータのことを追加パラメータ情報と呼ぶこととする。本項目では、ParameterDefとして追加する情報がJSON形式で保持されている。印刷設定編集モジュール2081は、追加パラメータ情報をオブジェクト化し、それらのデータをリスト化する。そして、印刷設定編集モジュール2081は、リスト化された各追加パラメータ情報がすでにPrintCapabilitiesに定義されているかを検索する。検索には、XPATH(XML Path Language)を利用する。XPATHはXMLにおける特定の個所を検索する機能を持ち、本実施形態ではPrintCapabilitiesから検索対象のParamterDefが存在しているかを検索する。   The DriverPropertyBag shown in the present embodiment refers to a data group in which model-dependent information is defined, and holds a character string called JSON (Java Script Object Notation) as shown in FIG. JSON is a data format that can be easily used by JavaScript, and is defined in a form that conforms to the definition of DriverPropertyBag. Hereinafter, these data are referred to as additional parameter information. In this item, information to be added as ParameterDef is held in the JSON format. The print setting editing module 2081 converts the additional parameter information into an object and lists the data. Then, the print setting editing module 2081 searches whether each additional parameter information listed is already defined in PrintCapabilities. For the search, XPATH (XML Path Language) is used. XPATH has a function of searching for a specific location in XML, and in this embodiment, searches for a ParameterDef as a search target from PrintCapabilities.

追加パラメータ情報を検索した結果、すでにPrintCapabilitiesに定義されていると判断した場合、以下のParameterDefの追加処理を行わずに、次の追加パラメータ情報の検索を行う。   As a result of searching the additional parameter information, if it is determined that the definition is already defined in the PrintCapabilities, the next additional parameter information is searched without performing the following ParameterDef addition processing.

もし追加パラメータ情報を検索した結果、PrintCapabilitiesに定義されていないと判断した場合はParameterDefの追加処理を行う。ParameterDefの追加処理に関しては、追加パラメータ情報をXMLNode形式として作成し、作成したXMLNodeをPrintCapabilitiesに追加する。   If it is determined as a result of searching for additional parameter information that it is not defined in PrintCapabilities, ParameterDef addition processing is performed. Regarding the ParameterDef addition processing, additional parameter information is created in the XMLNode format, and the created XMLNode is added to PrintCapabilities.

これらの処理をDriverPropertyBagで定義されている追加パラメータ情報に関するデータ群に対してすべて完了するまで繰り返す。以下がそのソースコードとなる。また、ソースコード内のGetParamDef関数は、XPATHを利用したParameterDefの検索を行う関数である。   These processes are repeated until all the data groups related to the additional parameter information defined in the DriverPropertyBag are completed. The following is the source code. Also, the GetParamDef function in the source code is a function that searches for ParameterDef using XPATH.


addParameterDef = function () {
// jsonParameterDef is a generated jsonobject by "ParameterDef" Property of the DriverPropertyBag.
if (jsonParameterDef) {
var arrayParameterDef = jsonParameterDef;

// Create New ParameterDef Node.
var newParameterDefNode = rootNode.createNode(1, "psf:ParameterDef", psfNs);
var newPropetyNode = rootNode.createNode(1, "psf:Property", psfNs);
var newValueNode = rootNode.createNode(1, "psf:Value", psfNs);
var newTypeNode = rootNode.createNode(2, "xsi:type", xsiNs);
var newTextValueNode = rootNode.createTextNode("");

// Add all items defined by DriverPropertyBag to PrintCapabilities as ParameterDefNode.
for (var i = 0, parameterDefLentgh = arrayParameterDef.length ; i < parameterDefLentgh; i++) {
var orgParameterDefName = arrayParameterDef[i].name;

var parameterDefName = GetSchemaName(orgParameterDefName);
var parameterDefNSPrefix = GetSchemaPrefix(orgParameterDefName);
var parameterDefNSUri = nsObj[parameterDefNSPrefix];

// If already defined ParameterDef by PrintCapabilities,
// Not add parameterDefNode in PrintCapabilities.
if (GetParamDef(pcNode, parameterDefNSUri, parameterDefName)) {
continue;
}

// Append cloned NewParameterDefNode to PrintCapabilities.
var parameterDefNode = newParameterDefNode.cloneNode(true);
parameterDefNode.setAttribute("name", orgParameterDefName);
var pcParameterDefNode = pcNode.appendChild(parameterDefNode);

// Add items defined by DriverPropertyBag to PrintCapabilities
// as PropertyNode.
for (var j = 0, jsonParameterDefItemLength = arrayParameterDef[i].item.length; j < jsonParameterDefItemLength; j++) {
var parameterDefItem = arrayParameterDef[i].item[j];

// Append cloned NewPropertyNode to ParameterDefNode.
var propertyNode = newPropetyNode.cloneNode(true);
propertyNode.setAttribute("name", parameterDefItem.name);
var pcPropertyNode = pcParameterDefNode.appendChild(propertyNode);

// Append cloned NewValueNode to PropertyNode.
var valueNode = newValueNode.cloneNode(true);
var pcValueNode = pcPropertyNode.appendChild(valueNode);

// Set cloned NewAttributeNode to ValueNode.
var typeNode = newTypeNode.cloneNode(true);
typeNode.value = parameterDefItem.type;
pcValueNode.setAttributeNode(typeNode);

// Append cloned NewValueTextNode to ValueNode.
var textNode = newTextValueNode.cloneNode(true);
textNode.text = parameterDefItem.value;
pcValueNode.appendChild(textNode);
}
}
}
}

上記のようなコードを実装することで、PrintCapabilitesに対してParameterDefの項目を追加することができる。

addParameterDef = function () {
// jsonParameterDef is a generated jsonobject by "ParameterDef" Property of the DriverPropertyBag.
if (jsonParameterDef) {
var arrayParameterDef = jsonParameterDef;

// Create New ParameterDef Node.
var newParameterDefNode = rootNode.createNode (1, "psf: ParameterDef", psfNs);
var newPropetyNode = rootNode.createNode (1, "psf: Property", psfNs);
var newValueNode = rootNode.createNode (1, "psf: Value", psfNs);
var newTypeNode = rootNode.createNode (2, "xsi: type", xsiNs);
var newTextValueNode = rootNode.createTextNode ("");

// Add all items defined by DriverPropertyBag to PrintCapabilities as ParameterDefNode.
for (var i = 0, parameterDefLentgh = arrayParameterDef.length; i <parameterDefLentgh; i ++) {
var orgParameterDefName = arrayParameterDef [i] .name;

var parameterDefName = GetSchemaName (orgParameterDefName);
var parameterDefNSPrefix = GetSchemaPrefix (orgParameterDefName);
var parameterDefNSUri = nsObj [parameterDefNSPrefix];

// If already defined ParameterDef by PrintCapabilities,
// Not add parameterDefNode in PrintCapabilities.
if (GetParamDef (pcNode, parameterDefNSUri, parameterDefName)) {
continue;
}

// Append cloned NewParameterDefNode to PrintCapabilities.
var parameterDefNode = newParameterDefNode.cloneNode (true);
parameterDefNode.setAttribute ("name", orgParameterDefName);
var pcParameterDefNode = pcNode.appendChild (parameterDefNode);

// Add items defined by DriverPropertyBag to PrintCapabilities
// as PropertyNode.
for (var j = 0, jsonParameterDefItemLength = arrayParameterDef [i] .item.length; j <jsonParameterDefItemLength; j ++) {
var parameterDefItem = arrayParameterDef [i] .item [j];

// Append cloned NewPropertyNode to ParameterDefNode.
var propertyNode = newPropetyNode.cloneNode (true);
propertyNode.setAttribute ("name", parameterDefItem.name);
var pcPropertyNode = pcParameterDefNode.appendChild (propertyNode);

// Append cloned NewValueNode to PropertyNode.
var valueNode = newValueNode.cloneNode (true);
var pcValueNode = pcPropertyNode.appendChild (valueNode);

// Set cloned NewAttributeNode to ValueNode.
var typeNode = newTypeNode.cloneNode (true);
typeNode.value = parameterDefItem.type;
pcValueNode.setAttributeNode (typeNode);

// Append cloned NewValueTextNode to ValueNode.
var textNode = newTextValueNode.cloneNode (true);
textNode.text = parameterDefItem.value;
pcValueNode.appendChild (textNode);
}
}
}
}

By implementing the above code, it is possible to add a ParameterDef item to PrintCapabilities.

次に、PrintCapabilitiesにParameterRefを追加する処理について説明する。ParameterRefとは、Option内に記載するXMLの属性のことであり、記載されたOptionに関連するParameterがどのParameterDefに関連しているかが定義されている。   Next, a process for adding ParameterRef to PrintCapabilities will be described. ParameterRef is an XML attribute described in Option, and it is defined which ParameterDef is related to the Parameter related to the described Option.

まず、DriverPropertyBagからJSONデータで記載された追加パラメータ情報を取得する。追加パラメータ情報には、「追加される対象のFeature名とOption名」、「追加するParameter名」が記載されている。次にParameterRefを追加するFeatureが定義されているかを判断するために、PrintCapabilitiesからXPATHを利用して検索する。もし、定義されていないと判断した場合は、ParameterRefの追加処理を行わずに処理を終了する。もし、定義されていると判断した場合は、追加される対象のOptionが定義されているかを判断するために、PrintCapabilitiesからXPATHを利用して検索する。もし、定義されていないと判断した場合は、ParameterRefの追加処理を行わずに処理を終了する。もし、定義されていると判断した場合は、ParameterRefが既に定義されているかを判断する。もし、定義されていると判断した場合は、ParameterRefの追加処理を行わずに処理を終了する。もし、定義されていないと判断した場合は、DriverPropertyBagから取得した追加パラメータ情報を利用して、ParameterRefのXMLNodeを作成し、対象のOptionに追加する。これらをDriverPropertyBagで定義されている追加パラメータ情報に関するデータに対してすべて完了するまで繰り返す。以下がそのソースコードとなる。また、ソースコード内のGetFeature関数、GetOption関数、GetParameterRef関数は、各Fetature、Option、ParameterRefの検索を行う関数である。   First, additional parameter information described in JSON data is acquired from DriverPropertyBag. In the additional parameter information, “Feature name and Option name to be added” and “Parameter name to be added” are described. Next, in order to determine whether or not a Feature for adding ParameterRef is defined, a search is performed from PrintCapabilities using XPATH. If it is determined that it is not defined, the process ends without performing the parameterref addition process. If it is determined that it is defined, a search is performed from PrintCapabilities using XPATH in order to determine whether the Option to be added is defined. If it is determined that it is not defined, the process ends without performing the parameterref addition process. If it is determined that it is defined, it is determined whether ParameterRef is already defined. If it is determined that it is defined, the process ends without performing the parameterref addition process. If it is determined that it is not defined, an XMLNode of ParameterRef is created using the additional parameter information acquired from DriverPropertyBag and added to the target Option. These are repeated until all of the data related to the additional parameter information defined in the DriverPropertyBag is completed. The following is the source code. Further, the GetFeature function, GetOption function, and GetParameterRef function in the source code are functions for searching for each Feature, Option, and ParameterRef.


addParameterRef = function () {
// jsonParameterRef is a generated jsonobject by "ParameterRef" Property of the DriverPropertyBag.
if (jsonParameterRef) {
var arrayParameterRef = jsonParameterRef;

// Create New ParameterRef Node.
var newParameterRefNode = rootNode.createNode(1, "psf:ParameterRef", psfNs);
var newScoredPropetyNode = rootNode.createNode(1, "psf:ScoredProperty", psfNs);

// Add All Defined DriverPropertyBag As ParameterRefNode.
for (var i = 0, parameterRefLength = arrayParameterRef.length; i < parameterRefLength; i++) {
var parameterRef = arrayParameterRef[i];
var orgParameterRefFeatureName = parameterRef.featureName;
var parameterRefFeatureName = GetSchemaName(orgParameterRefFeatureName);
var parameterRefFeatureNSPrefix = GetSchemaPrefix(orgParameterRefFeature);
var parameterRefFeatureNSUri = nsObj[parameterRefFeatureNSPrefix];
var arrayParameterRefOption = parameterRef.option;
var featureNode = GetFeature(pcNode, parameterRefFeatureNSUri, parameterRefFeatureName);

// Search FeatureNode of the additional Object.
if (featureNode) {
for (var j = 0, parameterRefOptionLength = arrayParameterRefOption.length; j < parameterRefOptionLength; j++) {
var p = arrayParameterRefOption[j];
var orgParameterRefOptionName = p.optionName;
var parameterRefOptionName = GetSchemaName(orgParameterRefOptionName);
var parameterRefOptionNSPrefix = GetSchemaPrefix(orgParameterRefOptionName);
var parameterRefOptionNSUri = nsObj[parameterRefOptionNSPrefix];
var optionNode = GetOption(featureNode, parameterRefOptionNSUri, parameterRefOptionName);

// Search OptionNode of the additional Object.
if (optionNode) {
var scoredPropertyName = p.scoredPropertyName;
var parameterRefName = p.parameterRefName;

// If already defined ParameterRef, not add printCapabilities.
if (!GetParameterRef(optionNode, GetSchemaPrefix(parameterRefName), GetSchemaName(parameterRefName))) {

// Append Cloned New scoredPropetyNode to OptionNode.
var scoredPropertyNode = newScoredPropetyNode.cloneNode(true);
scoredPropertyNode.setAttribute("name", scoredPropertyName);
var optionScoredPropertyNode = optionNode.appendChild(scoredPropertyNode);

// Append Cloned New ParameterRefNode to scoredPropetyNode.
var parameterRefNode = newParameterRefNode.cloneNode(true);
parameterRefNode.setAttribute("name", parameterRefName);
optionScoredPropertyNode.appendChild(parameterRefNode);
}
}
}
}
}
}
}
上記のようなコードを実装することで、PrintCapabilitesに対してParameterRefの項目を追加することができる。

addParameterRef = function () {
// jsonParameterRef is a generated jsonobject by "ParameterRef" Property of the DriverPropertyBag.
if (jsonParameterRef) {
var arrayParameterRef = jsonParameterRef;

// Create New ParameterRef Node.
var newParameterRefNode = rootNode.createNode (1, "psf: ParameterRef", psfNs);
var newScoredPropetyNode = rootNode.createNode (1, "psf: ScoredProperty", psfNs);

// Add All Defined DriverPropertyBag As ParameterRefNode.
for (var i = 0, parameterRefLength = arrayParameterRef.length; i <parameterRefLength; i ++) {
var parameterRef = arrayParameterRef [i];
var orgParameterRefFeatureName = parameterRef.featureName;
var parameterRefFeatureName = GetSchemaName (orgParameterRefFeatureName);
var parameterRefFeatureNSPrefix = GetSchemaPrefix (orgParameterRefFeature);
var parameterRefFeatureNSUri = nsObj [parameterRefFeatureNSPrefix];
var arrayParameterRefOption = parameterRef.option;
var featureNode = GetFeature (pcNode, parameterRefFeatureNSUri, parameterRefFeatureName);

// Search FeatureNode of the additional Object.
if (featureNode) {
for (var j = 0, parameterRefOptionLength = arrayParameterRefOption.length; j <parameterRefOptionLength; j ++) {
var p = arrayParameterRefOption [j];
var orgParameterRefOptionName = p.optionName;
var parameterRefOptionName = GetSchemaName (orgParameterRefOptionName);
var parameterRefOptionNSPrefix = GetSchemaPrefix (orgParameterRefOptionName);
var parameterRefOptionNSUri = nsObj [parameterRefOptionNSPrefix];
var optionNode = GetOption (featureNode, parameterRefOptionNSUri, parameterRefOptionName);

// Search OptionNode of the additional Object.
if (optionNode) {
var scoredPropertyName = p.scoredPropertyName;
var parameterRefName = p.parameterRefName;

// If already defined ParameterRef, not add printCapabilities.
if (! GetParameterRef (optionNode, GetSchemaPrefix (parameterRefName), GetSchemaName (parameterRefName))) {

// Append Cloned New scoredPropetyNode to OptionNode.
var scoredPropertyNode = newScoredPropetyNode.cloneNode (true);
scoredPropertyNode.setAttribute ("name", scoredPropertyName);
var optionScoredPropertyNode = optionNode.appendChild (scoredPropertyNode);

// Append Cloned New ParameterRefNode to scoredPropetyNode.
var parameterRefNode = newParameterRefNode.cloneNode (true);
parameterRefNode.setAttribute ("name", parameterRefName);
optionScoredPropertyNode.appendChild (parameterRefNode);
}
}
}
}
}
}
}
By implementing the above code, the ParameterRef item can be added to PrintCapabilities.

次に、Feature項目をSubFeatureに変換する処理について説明する。   Next, processing for converting a Feature item into SubFeature will be described.

SubFeatureとは、Feature内に存在するFeatureのことを指し、Feature間の高い関連性を表現する際に使用する。GPDではSubFeatureを定義することはできないため、GPDではFeatureとして定義しておき、印刷設定変更モジュール2081において、FeatureをSubFeatureとして変換する。以下、SubFeture変換処理に関して説明する。   “SubFeature” refers to a feature existing in the feature, and is used to express a high relationship between the features. In GPD, SubFeature cannot be defined, so in GPD, it is defined as Feature, and in the print setting change module 2081, Feature is converted as SubFeature. Hereinafter, the SubFeature conversion process will be described.

まず、DriverPropertyBagからJSONデータを取得する。JSONデータには、「変換対象のFeature名」と、「追加対象のFeature名」が記載されている。以下、この情報を変換パラメータ情報と呼ぶこととする。次に、SubFeatureを追加する対象Featureが定義されているかを判断するために、PrintCapabilitiesからXPATHを利用して検索する。もし、定義されていないと判断した場合は、SubFeatureへの変換を行わずに処理を終了する。もし定義されていると判断した場合は、変換対象のFeatureが定義されているかを判断するために、PrintCapabilitiesからXPATHを利用して検索する。もし、定義されていないと判断した場合は、SubFeatureへの変換を行わずに処理を終了する。もし定義されていると判断した場合は、DriverPropertyBagから取得した変換パラメータの情報と、変換対象のFeatureをSubFeatureの定義に沿った形に変換し、追加対象のFeatureに移動する。   First, the JSON data is acquired from the DriverPropertyBag. The JSON data describes “feature name to be converted” and “feature name to be added”. Hereinafter, this information is referred to as conversion parameter information. Next, in order to determine whether or not a target Feature to which SubFeature is added is defined, a search is performed from PrintCapabilities using XPATH. If it is determined that it is not defined, the process ends without performing conversion to SubFeature. If it is determined that the feature to be converted is defined, a search is performed from PrintCapabilities using XPATH to determine whether the feature to be converted is defined. If it is determined that it is not defined, the process ends without performing conversion to SubFeature. If it is determined that it is defined, the conversion parameter information acquired from the DriverPropertyBag and the conversion target feature are converted into a form conforming to the definition of the subfeature, and moved to the addition target feature.

これらをDriverPropertyBagで定義されている変換パラメータ情報に関するデータに対してすべて完了するまで繰り返す。以下がそのソースコードとなる。また、ソースコード内のGetFeature関数は、Featureの検索を行う関数である。   These are repeated until all of the data relating to the conversion parameter information defined in the DriverPropertyBag is completed. The following is the source code. Further, the GetFeature function in the source code is a function for searching for a Feature.


convertSubFeature = function () {
var ConvertToSubfeatureNode = function ConvertToSubfeatureNode(pcNode, moveFeatureNode, parentNode) {
var removedFeature = pcNode.removeChild(moveFeatureNode);
if (removedFeature) {
if (parentNode) {
if (parentNSPrefix == pskPrefix) {
//Change namespace、delete scope.
var attirbuteName = removedFeature.getAttribute("name");
var nonScopeAttirbuteName = attirbuteName.substring(attirbuteName.indexOf(":") + 1);
var newAttributeName = "";

//When top character string had Scope, I delete it
if (nonScopeAttirbuteName.indexOf("Job") == 0) {
newAttributeName = pskPrefix + ":" + nonScopeAttirbuteName.replace("Job", "");
} else if (nonScopeAttirbuteName.indexOf("Document") == 0) {
newAttributeName = pskPrefix + ":" + nonScopeAttirbuteName.replace("Document", "");
} else if (nonScopeAttirbuteName.indexOf("Page") == 0) {
newAttributeName = pskPrefix + ":" + nonScopeAttirbuteName.replace("Page", "");
} else {
newAttributeName = attirbuteName;
}
removedFeature.setAttribute("name", newAttributeName);

}
parentNode.appendChild(removedFeature);
}
}
};

// jsonSubFeature is a generated jsonobject by "ParameterRef" Property of the DriverPropertyBag.
if (jsonSubFeature) {
// Convert All items defined by DriverPropertyBag to PrintCapabilities as SubFeature.
for (var i = 0, jsonSubFeatureLength = jsonSubFeature.length; i < jsonSubFeatureLength; i++) {
//var sf = jsonSubFeature.subFeature[i];
var sf = jsonSubFeature[i];
var parentName = GetSchemaName(sf.parent);
var parentNSPrefix = GetSchemaPrefix(sf.parent);
var parentNSUri = nsObj[parentNSPrefix];
var parentNode = GetFeature(pcNode, parentNSUri, parentName);

// If parentNode is nothing, do not convert SubFeature.
if (parentNode) {
var subfeatureName = GetSchemaName(sf.subfeature);
var subfeatureNSPrefix = GetSchemaPrefix(sf.subfeature);
var subfeatureNSUri = nsObj[subfeatureNSPrefix];
var subfeatureNode = GetFeature(pcNode, subfeatureNSUri, subfeatureName);

// If subfeatureNode is nothing, do not convert SubFeature.
if (subfeatureNode) {
ConvertToSubfeatureNode(pcNode, subfeatureNode, parentNode);
}
}
}
}
}
上記のようなコードを実装することで、PrintCapabilitesに対してFeatureからSubFeatureへの変換処理を行うことができる。

convertSubFeature = function () {
var ConvertToSubfeatureNode = function ConvertToSubfeatureNode (pcNode, moveFeatureNode, parentNode) {
var removedFeature = pcNode.removeChild (moveFeatureNode);
if (removedFeature) {
if (parentNode) {
if (parentNSPrefix == pskPrefix) {
// Change namespace, delete scope.
var attirbuteName = removedFeature.getAttribute ("name");
var nonScopeAttirbuteName = attirbuteName.substring (attirbuteName.indexOf (":") + 1);
var newAttributeName = "";

// When top character string had Scope, I delete it
if (nonScopeAttirbuteName.indexOf ("Job") == 0) {
newAttributeName = pskPrefix + ":" + nonScopeAttirbuteName.replace ("Job", "");
} else if (nonScopeAttirbuteName.indexOf ("Document") == 0) {
newAttributeName = pskPrefix + ":" + nonScopeAttirbuteName.replace ("Document", "");
} else if (nonScopeAttirbuteName.indexOf ("Page") == 0) {
newAttributeName = pskPrefix + ":" + nonScopeAttirbuteName.replace ("Page", "");
} else {
newAttributeName = attirbuteName;
}
removedFeature.setAttribute ("name", newAttributeName);

}
parentNode.appendChild (removedFeature);
}
}
};

// jsonSubFeature is a generated jsonobject by "ParameterRef" Property of the DriverPropertyBag.
if (jsonSubFeature) {
// Convert All items defined by DriverPropertyBag to PrintCapabilities as SubFeature.
for (var i = 0, jsonSubFeatureLength = jsonSubFeature.length; i <jsonSubFeatureLength; i ++) {
// var sf = jsonSubFeature.subFeature [i];
var sf = jsonSubFeature [i];
var parentName = GetSchemaName (sf.parent);
var parentNSPrefix = GetSchemaPrefix (sf.parent);
var parentNSUri = nsObj [parentNSPrefix];
var parentNode = GetFeature (pcNode, parentNSUri, parentName);

// If parentNode is nothing, do not convert SubFeature.
if (parentNode) {
var subfeatureName = GetSchemaName (sf.subfeature);
var subfeatureNSPrefix = GetSchemaPrefix (sf.subfeature);
var subfeatureNSUri = nsObj [subfeatureNSPrefix];
var subfeatureNode = GetFeature (pcNode, subfeatureNSUri, subfeatureName);

// If subfeatureNode is nothing, do not convert SubFeature.
if (subfeatureNode) {
ConvertToSubfeatureNode (pcNode, subfeatureNode, parentNode);
}
}
}
}
}
By implementing the code as described above, PrintCapabilities can be converted from Feature to SubFeature.

次に、PrintCapabilitesに記載されている有効印字領域の変更処理に関して説明する。PrintCapabilitesには、PageImageableSizeと呼ばれる有効印字領域に関するPropertyが設定されている。本実施形態では、ユーザーが余白設定を行った際に正しい有効印字領域となるように、PrintCapabilitiesの値を書き換える処理を行う。   Next, the effective print area changing process described in PrintCapabilities will be described. A property related to an effective print area called “PageImageableSize” is set in PrintCapabilities. In the present embodiment, a process for rewriting the value of PrintCapabilities is performed so that a correct effective print area is obtained when the user performs margin setting.

まず、現在の印刷設定つまりPrintTicketにおいて、余白設定が有効になっているかを確認する。余白設定が有効になっていた場合は、PrintCapabilitiesから有効印字領域に関するPropertyである、PageImageableSizeを検索する。PageImageableSizeが定義されている場合、現在設定されている用紙サイズを取得する。次に、余白設定として指定してあるParameterInitの余白設定値(上下左右の余白値)を取得する。そして、用紙サイズ、余白設定値から、有効印字領域および印字開始位置の原点を計算し、PageImageableSizeに設定する。以下がそのソースコードとなる。また、ソースコード内のGetParamInit関数、GetProperty関数、GetFeature関数は、XPATHを利用したParameterInit、Property、Featureの検索を行う関数である。   First, it is confirmed whether the margin setting is valid in the current print setting, that is, the PrintTicket. If the margin setting is valid, a page imageable size that is a property related to an effective print area is searched from PrintCapabilities. If PageImageableSize is defined, the currently set paper size is acquired. Next, the margin setting values (upper and lower left and right margin values) of ParameterInit designated as the margin setting are acquired. Then, the origin of the effective print area and the print start position is calculated from the paper size and the margin setting value, and is set to PageImageableSize. The following is the source code. Further, the GetParamInit function, GetProperty function, and GetFeature function in the source code are functions for searching ParameterInit, Property, and Feature using XPATH.


setImageableSize = function () {
var jobPrintMarginAdjustmentNode = GetFeature(ptNode, privateNs, "JobMarginAdjust");
if (jobPrintMarginAdjustmentNode) {
// Get jobPrintMarginAdjustmentNode Feature Selected Node.
var marginSelectedOptionNode = jobPrintMarginAdjustmentNode.selectSingleNode("descendant::psf:Option");
var selectedOptionAttributeName = marginSelectedOptionNode.getAttribute("name");
var selectedOptionName = GetSchemaName(selectedOptionAttributeName);

if (selectedOptionName == "MarginAdjust") {
var pageImageableSizeNode = GetProperty(pcNode, pskNs, "PageImageableSize");

if (pageImageableSizeNode) {
var pageImageableAreaNode = GetProperty(pcNode, pskNs, "ImageableArea");

if (pageImageableAreaNode) {
var pageMediaSizeNode = GetFeature(ptNode, pskNs, "PageMediaSize");

if (pageMediaSizeNode) {
// Get pageMediaSizeNode Feature Selected Node.
var selectedOptionNode = pageMediaSizeNode.selectSingleNode(xpath);
var mediaSizeWidthNode = GetScoredProperty(selectedOptionNode, pskNs, "MediaSizeWidth");
var mediaSizeHeightNode = GetScoredProperty(selectedOptionNode, pskNs, "MediaSizeHeight");
var marginTopNode = GetParamInit(ptNode, privateNs, "JobMarginAdjustTop");
var marginBottomNode = GetParamInit(ptNode, privateNs, "JobMarginAdjustBottom");
var marginLeftNode = GetParamInit(ptNode, privateNs, "JobMarginAdjustLeft");
var marginRightNode = GetParamInit(ptNode, privateNs, "JobMarginAdjustRight");

// When I cannot get these parameters, do not set it.
if (!(mediaSizeWidthNode == null) || !(mediaSizeHeightNode == null) || !(marginTopNode == null) || !(marginBottomNode == null) || !(marginLeftNode == null) || !(marginRightNode == null)) {
var mediaSizeWidth = mediaSizeWidthNode.text;
var mediaSizeHeight = mediaSizeHeightNode.text;
var marginTop = marginTopNode.text;
var marginBottom = marginBottomNode.text;
var marginLeft = marginLeftNode.text;
var marginRight = marginRightNode.text;

// Set ImageableArea Property
var imageableSizeWidthNode = GetProperty(pageImageableSizeNode, pskNs, "ImageableSizeWidth");
if (imageableSizeWidthNode) {
imageableSizeWidthNode.firstChild.text = mediaSizeWidth;
}

var imageableSizeHeightNode = GetProperty(pageImageableSizeNode, pskNs, "ImageableSizeHeight");
if (imageableSizeHeightNode) {
imageableSizeHeightNode.firstChild.text = mediaSizeHeight;
}

var originWidthNode = GetProperty(pageImageableAreaNode, pskNs, "OriginWidth");
if (originWidthNode) {
originWidthNode.firstChild.text = marginLeft;
}

var originHeightNode = GetProperty(pageImageableAreaNode, pskNs, "OriginHeight");
if (originHeightNode) {
originHeightNode.firstChild.text = marginTop;
}

var ExtentWidthNode = GetProperty(pageImageableAreaNode, pskNs, "ExtentWidth");
if (ExtentWidthNode) {
var ExtentWidth = mediaSizeWidth - marginLeft - marginRight;
if (ExtentWidth < 1000) {
ExtentWidthNode.firstChild.text = 1000;
}
else {
ExtentWidthNode.firstChild.text = ExtentWidth;
}
}

var ExtentHeightNode = GetProperty(pageImageableAreaNode, pskNs, "ExtentHeight");
if (ExtentHeightNode) {
var ExtentHeight = mediaSizeHeight - marginTop - marginBottom;
if (ExtentHeight < 1000) {
ExtentHeightNode.firstChild.text = 1000;
}
else {
ExtentHeightNode.firstChild.text = ExtentHeight;
}
}
}
}
}
}
}
}
}
上記のようなコードを実装することで、余白設定を行った際の有効印字領域の変更を行うことができる。

setImageableSize = function () {
var jobPrintMarginAdjustmentNode = GetFeature (ptNode, privateNs, "JobMarginAdjust");
if (jobPrintMarginAdjustmentNode) {
// Get jobPrintMarginAdjustmentNode Feature Selected Node.
var marginSelectedOptionNode = jobPrintMarginAdjustmentNode.selectSingleNode ("descendant :: psf: Option");
var selectedOptionAttributeName = marginSelectedOptionNode.getAttribute ("name");
var selectedOptionName = GetSchemaName (selectedOptionAttributeName);

if (selectedOptionName == "MarginAdjust") {
var pageImageableSizeNode = GetProperty (pcNode, pskNs, "PageImageableSize");

if (pageImageableSizeNode) {
var pageImageableAreaNode = GetProperty (pcNode, pskNs, "ImageableArea");

if (pageImageableAreaNode) {
var pageMediaSizeNode = GetFeature (ptNode, pskNs, "PageMediaSize");

if (pageMediaSizeNode) {
// Get pageMediaSizeNode Feature Selected Node.
var selectedOptionNode = pageMediaSizeNode.selectSingleNode (xpath);
var mediaSizeWidthNode = GetScoredProperty (selectedOptionNode, pskNs, "MediaSizeWidth");
var mediaSizeHeightNode = GetScoredProperty (selectedOptionNode, pskNs, "MediaSizeHeight");
var marginTopNode = GetParamInit (ptNode, privateNs, "JobMarginAdjustTop");
var marginBottomNode = GetParamInit (ptNode, privateNs, "JobMarginAdjustBottom");
var marginLeftNode = GetParamInit (ptNode, privateNs, "JobMarginAdjustLeft");
var marginRightNode = GetParamInit (ptNode, privateNs, "JobMarginAdjustRight");

// When I cannot get these parameters, do not set it.
if (! (mediaSizeWidthNode == null) ||! (mediaSizeHeightNode == null) ||! (marginTopNode == null) ||! (marginBottomNode == null) ||! (marginLeftNode == null) ||! (marginRightNode == null)) {
var mediaSizeWidth = mediaSizeWidthNode.text;
var mediaSizeHeight = mediaSizeHeightNode.text;
var marginTop = marginTopNode.text;
var marginBottom = marginBottomNode.text;
var marginLeft = marginLeftNode.text;
var marginRight = marginRightNode.text;

// Set ImageableArea Property
var imageableSizeWidthNode = GetProperty (pageImageableSizeNode, pskNs, "ImageableSizeWidth");
if (imageableSizeWidthNode) {
imageableSizeWidthNode.firstChild.text = mediaSizeWidth;
}

var imageableSizeHeightNode = GetProperty (pageImageableSizeNode, pskNs, "ImageableSizeHeight");
if (imageableSizeHeightNode) {
imageableSizeHeightNode.firstChild.text = mediaSizeHeight;
}

var originWidthNode = GetProperty (pageImageableAreaNode, pskNs, "OriginWidth");
if (originWidthNode) {
originWidthNode.firstChild.text = marginLeft;
}

var originHeightNode = GetProperty (pageImageableAreaNode, pskNs, "OriginHeight");
if (originHeightNode) {
originHeightNode.firstChild.text = marginTop;
}

var ExtentWidthNode = GetProperty (pageImageableAreaNode, pskNs, "ExtentWidth");
if (ExtentWidthNode) {
var ExtentWidth = mediaSizeWidth-marginLeft-marginRight;
if (ExtentWidth <1000) {
ExtentWidthNode.firstChild.text = 1000;
}
else {
ExtentWidthNode.firstChild.text = ExtentWidth;
}
}

var ExtentHeightNode = GetProperty (pageImageableAreaNode, pskNs, "ExtentHeight");
if (ExtentHeightNode) {
var ExtentHeight = mediaSizeHeight-marginTop-marginBottom;
if (ExtentHeight <1000) {
ExtentHeightNode.firstChild.text = 1000;
}
else {
ExtentHeightNode.firstChild.text = ExtentHeight;
}
}
}
}
}
}
}
}
}
By implementing the code as described above, it is possible to change the effective print area when the margin is set.

また、上記以外にもPageInputBinとよばれる給紙段に関するFeatureに対して、各給紙段の能力情報を追加する処理等を行うが、追加処理の手段は前述と同等の手段を用いているため省略する。   In addition to the above, processing for adding capability information of each paper feed stage is performed on the feature relating to the paper feed stage called PageInputBin. However, the means for the addition process uses the same means as described above. Omitted.

以上の処理により、PrintCapabilitiesの印刷設定編集処理を完了する。   With the above processing, the print settings editing processing of PrintCapabilities is completed.


・convertDevmodeToPrintticket
本関数では、DEVMODEの値をPrintTicketに登録する場合に呼び出される関数である。特に、本実施形態ではGPDには記載できないParameterに関する追加処理をPrintTicketに対して行う処理と、DEVMODEに登録されているParameterに関する値をPrintTicketに反映するための処理を行う。本実施形態では、主に以下の機能について説明する。

ConvertDevmodeToPrintticket
This function is a function that is called when the value of DEVMODE is registered in the PrintTicket. In particular, in this embodiment, a process for performing an additional process related to a parameter that cannot be described in the GPD is performed on the print ticket, and a process for reflecting a value related to the parameter registered in the DEVMODE to the print ticket. In the present embodiment, the following functions are mainly described.

− ParameterInitの追加
− DEVMODEの値をParameterInitに反映
以下に、ParameterInitの追加から順に処理内容を説明する。
-Addition of ParameterInit-Reflect DEVMODE value in ParameterInit The processing contents will be described in order from the addition of ParameterInit.

まず、convertDevmodeToPrintTicketの関数が呼ばれると、印刷設定編集モジュール2801は、OSから受けとったプロパティバッグ2082へアクセスするためのオブジェクトを生成する。本実施形態では、ドライバーが対応する機種の情報が保存されたDriverPropertyBagへアクセスするためのオブジェクトを用意する。   First, when a function of convertDevmodeToPrintTicket is called, the print setting editing module 2801 generates an object for accessing the property bag 2082 received from the OS. In the present embodiment, an object for accessing the DriverPropertyBag in which the information on the model supported by the driver is stored is prepared.

印刷設定編集モジュール2081は、追加パラメータ情報をオブジェクト化し、それらのデータをリスト化する。そして、印刷設定編集モジュール2081は、リスト化された各情報がすでにPrintTicketに定義されているかを検索する。検索には、XPATHを利用する。本項目では、検索対象のParameterInitが存在しているかを検索する。次に、追加パラメータ情報に対応するParameterがDEVMODEに定義されているかを判断する。あらかじめ特定のParameterをDEVMDOEに定義するためには、図6のようなXML形式で記述されたDEVMODE定義ファイルをプリンタードライバーパッケージに同梱しておく必要がある。DEVMODEに定義されていない場合は以下の追加処理は行わず、次の追加パラメータ情報の処理に進む。もし、定義されていると判断した場合は、DEVMODEに登録された値を取得する。次に、取得したパラメータ値が適切かどうかをチェックする。適切なパラメータとは、データ形式がPrintTicketの定義と合致しているか、最大値と最小値の範囲内に収まっているかなどの精査を行う。もし、適切でないと判断した場合は追加パラメータ情報に記載されているデフォルトの値に変更する。本実施形態では、デフォルト値に変更するような処理を行ったが、最大値もしくは最小値などに変更してもよい。   The print setting editing module 2081 converts the additional parameter information into an object and lists the data. Then, the print setting editing module 2081 searches whether each listed information is already defined in the PrintTicket. XPATH is used for the search. In this item, it is searched whether there is a ParameterInit to be searched. Next, it is determined whether a parameter corresponding to the additional parameter information is defined in DEVMODE. In order to define a specific parameter in DEVMDOE in advance, a DEVMODE definition file described in XML format as shown in FIG. 6 needs to be included in the printer driver package. If it is not defined in DEVMODE, the following additional processing is not performed, and the processing proceeds to the next additional parameter information processing. If it is determined that it is defined, the value registered in DEVMODE is acquired. Next, it is checked whether the acquired parameter value is appropriate. The appropriate parameter is scrutinized whether the data format matches the definition of PrintTicket or whether it falls within the range of the maximum value and the minimum value. If it is determined to be inappropriate, it is changed to the default value described in the additional parameter information. In the present embodiment, the process of changing to the default value is performed, but it may be changed to the maximum value or the minimum value.

次に、検索されたParameterInitが存在すると判断した場合は、対象のParameterInitの値に取得したDEVMODEの値を反映させる。もし、存在しないと判断した場合は、ParameterInitの追加処理を行う。ParameterInitの追加処理に関しては、追加パラメータ情報をXMLNode形式として作成し、作成したXMLNodeをPrintTicketに追加する。   Next, when it is determined that the searched ParameterInit exists, the acquired DEVMODE value is reflected in the target ParameterInit value. If it is determined that it does not exist, ParameterInit is added. Regarding the ParameterInit addition process, additional parameter information is created in the XMLNode format, and the created XMLNode is added to the PrintTicket.

これらの処理をDriverPropertyBagで定義されている追加パラメータ情報に関するデータ群に対してすべて完了するまで繰り返す。以下がそのソースコードとなる。また、ソースコード内のGetParamInit関数は、XPATHを利用したParameterInitの検索を行う関数である。   These processes are repeated until all the data groups related to the additional parameter information defined in the DriverPropertyBag are completed. The following is the source code. The GetParamInit function in the source code is a function that searches for ParameterInit using XPATH.


addParameterInit = function () {
var dataType,
defaultValue,
checkParameter = function () {
var maxValue;
var minValue;
var maxLength;
var minLength;

for (var j = 0, jsonParameterDefItemLength = arrayParameterDef[i].item.length; j < jsonParameterDefItemLength; j++) {
var parameterInitItem = arrayParameterDef[i].item[j];
switch (parameterInitItem.name) {
case "psf:DataType":
dataType = parameterInitItem.value; break;
case "psf:DefaultValue":
defaultValue = parameterInitItem.value; break;
case "psf:MaxLength":
maxLength = parameterInitItem.value; break;
case "psf:MinLength":
minLength = parameterInitItem.value; break;
case "psf:MaxValue":
maxValue = parameterInitItem.value; break;
case "psf:MinValue":
minValue = parameterInitItem.value; break;
default:
break;
}
}

if (dataType == "xsd:string") {
if (minLength == null || maxLength == null) {
return;
}

if ((devmodeString.length >= minLength) && (devmodeString.length <= maxLength)) {
}
else {
devmodeString = defaultValue;
}
}

if (dataType == "xsd:integer") {
if (minValue == null || maxValue == null) {
return;
}

devmodeString = devmodeString.replace(/[ \t]+/g, '');
// I make a decision whether it is numerical value
if (devmodeString.match(/^[-]?\d+(\.\d+)?$/)) {
// numeric value
devmodeString = Number(devmodeString);
if ((devmodeString < minValue) || (devmodeString > maxValue)) {
devmodeString = defaultValue;
}
} else {
// besides numerical value
devmodeString = defaultValue;
}
}
};

// Create JsonObject with the "ParameterDef" Property of the DriverPropertyBag.
var jsonParameterDef = CreateJsonObject(driverPropertyBag, "ParameterDef");
if(jsonParameterDef) {
var arrayParameterDef = jsonParameterDef.parameterDef;

// Create New ParameterInit Node.
var newParameteInitNode = rootNode.createNode(1, "psf:ParameterInit", psfNs);
var newValueNode = rootNode.createNode(1, "psf:Value", psfNs);
var newTypeNode = rootNode.createNode(2, "xsi:type", xsiNs);
var newTextValueNode = rootNode.createTextNode("");


// Add items defined by DriverPropertyBag to PrintTicket as ParameterInitNode.
for (var i = 0, jsonParameterDefLength = arrayParameterDef.length; i < jsonParameterDefLength; i++) {
var parameterDef = arrayParameterDef[i];
var orgParameterInitName = parameterDef.name;
var parameterInitName = GetSchemaName(orgParameterInitName);
var parameterInitNSPrefix = GetSchemaPrefix(orgParameterInitName);
var parameterInitNSUri = nsObj[parameterInitNSPrefix];
var ptParameterInitNode = GetParamInit(ptNode, parameterInitNSUri, parameterInitName);

// Get DevmodeMap value
var devmodeString = "";
try {
devmodeString = devModeProperties.GetString(parameterInitName);
} catch (errorObject) {
// When DevmodeMap does not have a definition, not handle the following
continue;
}

// I check it whether a value of DevmodeMap is right
checkParameter();

if (!ptParameterInitNode) {
// If ParameterInit is none, create it.
var parameterInitNode = newParameteInitNode.cloneNode(true);
parameterInitNode.setAttribute("name", orgParameterInitName);

ptParameterInitNode = ptNode.appendChild(parameterInitNode);

var valueNode = newValueNode.cloneNode(true);
var ptValueNode = ptParameterInitNode.appendChild(valueNode);

var typeNode = newTypeNode.cloneNode(true);
typeNode.value = dataType;
ptValueNode.setAttributeNode(typeNode);

var textNode = newTextValueNode.cloneNode(true);
if (devmodeString != "") {
// set DevmodeMap Value
textNode.text = devmodeString;
}
else {
// set default Value.
textNode.text = defaultValue;
}
ptValueNode.appendChild(textNode);

} else {
if (devmodeString != "") {
ptParameterInitNode.firstChild.text = devmodeString;
}
}
}
}
}

上記のようなコードを実装することで、PrintTicketの追加およびDEVMODEへの値の反映を行うことができる。

addParameterInit = function () {
var dataType,
defaultValue,
checkParameter = function () {
var maxValue;
var minValue;
var maxLength;
var minLength;

for (var j = 0, jsonParameterDefItemLength = arrayParameterDef [i] .item.length; j <jsonParameterDefItemLength; j ++) {
var parameterInitItem = arrayParameterDef [i] .item [j];
switch (parameterInitItem.name) {
case "psf: DataType":
dataType = parameterInitItem.value; break;
case "psf: DefaultValue":
defaultValue = parameterInitItem.value; break;
case "psf: MaxLength":
maxLength = parameterInitItem.value; break;
case "psf: MinLength":
minLength = parameterInitItem.value; break;
case "psf: MaxValue":
maxValue = parameterInitItem.value; break;
case "psf: MinValue":
minValue = parameterInitItem.value; break;
default:
break;
}
}

if (dataType == "xsd: string") {
if (minLength == null || maxLength == null) {
return;
}

if ((devmodeString.length> = minLength) && (devmodeString.length <= maxLength)) {
}
else {
devmodeString = defaultValue;
}
}

if (dataType == "xsd: integer") {
if (minValue == null || maxValue == null) {
return;
}

devmodeString = devmodeString.replace (/ [\ t] + / g, '');
// I make a decision whether it is numerical value
if (devmodeString.match (/ ^ [-]? \ d + (\. \ d +)? $ /)) {
// numeric value
devmodeString = Number (devmodeString);
if ((devmodeString <minValue) || (devmodeString> maxValue)) {
devmodeString = defaultValue;
}
} else {
// besides numerical value
devmodeString = defaultValue;
}
}
};

// Create JsonObject with the "ParameterDef" Property of the DriverPropertyBag.
var jsonParameterDef = CreateJsonObject (driverPropertyBag, "ParameterDef");
if (jsonParameterDef) {
var arrayParameterDef = jsonParameterDef.parameterDef;

// Create New ParameterInit Node.
var newParameteInitNode = rootNode.createNode (1, "psf: ParameterInit", psfNs);
var newValueNode = rootNode.createNode (1, "psf: Value", psfNs);
var newTypeNode = rootNode.createNode (2, "xsi: type", xsiNs);
var newTextValueNode = rootNode.createTextNode ("");


// Add items defined by DriverPropertyBag to PrintTicket as ParameterInitNode.
for (var i = 0, jsonParameterDefLength = arrayParameterDef.length; i <jsonParameterDefLength; i ++) {
var parameterDef = arrayParameterDef [i];
var orgParameterInitName = parameterDef.name;
var parameterInitName = GetSchemaName (orgParameterInitName);
var parameterInitNSPrefix = GetSchemaPrefix (orgParameterInitName);
var parameterInitNSUri = nsObj [parameterInitNSPrefix];
var ptParameterInitNode = GetParamInit (ptNode, parameterInitNSUri, parameterInitName);

// Get DevmodeMap value
var devmodeString = "";
try {
devmodeString = devModeProperties.GetString (parameterInitName);
} catch (errorObject) {
// When DevmodeMap does not have a definition, not handle the following
continue;
}

// I check it whether a value of DevmodeMap is right
checkParameter ();

if (! ptParameterInitNode) {
// If ParameterInit is none, create it.
var parameterInitNode = newParameteInitNode.cloneNode (true);
parameterInitNode.setAttribute ("name", orgParameterInitName);

ptParameterInitNode = ptNode.appendChild (parameterInitNode);

var valueNode = newValueNode.cloneNode (true);
var ptValueNode = ptParameterInitNode.appendChild (valueNode);

var typeNode = newTypeNode.cloneNode (true);
typeNode.value = dataType;
ptValueNode.setAttributeNode (typeNode);

var textNode = newTextValueNode.cloneNode (true);
if (devmodeString! = "") {
// set DevmodeMap Value
textNode.text = devmodeString;
}
else {
// set default Value.
textNode.text = defaultValue;
}
ptValueNode.appendChild (textNode);

} else {
if (devmodeString! = "") {
ptParameterInitNode.firstChild.text = devmodeString;
}
}
}
}
}

By mounting the above code, it is possible to add a PrintTicket and reflect the value to DEVMODE.

また本関数では、ParameterRefの追加、SubFeatureの変換、PageInputBinの追加処理を行うが、前述したPrintCapabilitiesの追加処理の追加対象先をPrintTicketとしている違いのみであるため、省略する。   In this function, ParameterRef addition, SubFeature conversion, and PageInputBin addition processing are performed. However, since only the addition target of the above-described PrintCapabilities addition processing is a PrintTicket, the description is omitted.

以上の処理により、PrintTicketの精査に関する印刷設定編集処理を完了する。
・convertPrintticketToDevmode
本関数では、PrintTicketの値をDEVMODEに登録する場合に呼び出される関数である。特に、本実施形態ではGPDには記載できないParameterに関する値をDEVMODEに登録する処理を行う。本実施形態では、主に以下の機能を有する。
With the above processing, the print setting editing processing related to the PrintTicket scrutiny is completed.
ConvertprintticketToDevmode
This function is a function called when registering the value of PrintTicket in DEVMODE. In particular, in the present embodiment, a process for registering a value related to Parameter that cannot be described in GPD in DEVMODE is performed. This embodiment mainly has the following functions.

− ParameterInitの値をDEVMODEに登録する
以下に、ParameterInitの値をDEVMODEに反映する処理について説明する。まず、convertPrintticketToDevmodeの関数が呼ばれると、印刷設定編集モジュール2801は、OSから受けとったプロパティバッグ2082へアクセスするためのオブジェクトを生成する。本実施形態では、ドライバーが対応する機種の情報が保存されたDriverPropertyBagへアクセスするためのオブジェクトを用意する。
-Registering the value of ParameterInit in DEVMODE The process for reflecting the value of ParameterInit in DEVMODE will be described below. First, when the convertPrinttToDevmode function is called, the print setting editing module 2801 generates an object for accessing the property bag 2082 received from the OS. In the present embodiment, an object for accessing the DriverPropertyBag in which the information on the model supported by the driver is stored is prepared.

印刷設定編集モジュール2081は、追加パラメータ情報をオブジェクト化し、それらのデータをリスト化する。そして、印刷設定編集モジュール2081は、リスト化された各情報がすでにPrintTicketに定義されているかを検索する。検索には、XPATHを利用する。次に、取得したパラメータ値が適切かどうかをチェックする。適切なパラメータとは、データ形式がPrintTicketの定義と合致しているか、最大値と最小値の範囲内に収まっているかなどの精査を行う。もし、適切でないと判断した場合は追加パラメータ情報に記載されているデフォルトの値に変更する。本実施形態では、デフォルト値に変更するような処理を行ったが、最大値もしくは最小値などに変更してもよい。   The print setting editing module 2081 converts the additional parameter information into an object and lists the data. Then, the print setting editing module 2081 searches whether each listed information is already defined in the PrintTicket. XPATH is used for the search. Next, it is checked whether the acquired parameter value is appropriate. The appropriate parameter is scrutinized whether the data format matches the definition of PrintTicket or whether it falls within the range of the maximum value and the minimum value. If it is determined to be inappropriate, it is changed to the default value described in the additional parameter information. In the present embodiment, the process of changing to the default value is performed, but it may be changed to the maximum value or the minimum value.

次に、検索されたParameterInitが存在すると判断した場合は、対象となるParameterInitの値をDEVMODEに登録する。もし、存在しないと判断した場合は、DEVMODEへの登録は行わない。これらの処理をDriverPropertyBagで定義されている追加パラメータ情報に関するデータ群に対してすべて完了するまで繰り返す。以下がそのソースコードとなる。また、ソースコード内のGetParamInit関数は、XPATHを利用したParameterInitの検索を行う関数である。また、適切なパラメータのチェックを行う関数は前述したソースコードと同一であるため省略する。   Next, when it is determined that the searched ParameterInit exists, the value of the target ParameterInit is registered in DEVMODE. If it is determined that it does not exist, registration in DEVMODE is not performed. These processes are repeated until all the data groups related to the additional parameter information defined in the DriverPropertyBag are completed. The following is the source code. The GetParamInit function in the source code is a function that searches for ParameterInit using XPATH. A function for checking an appropriate parameter is the same as the source code described above, and is omitted.


setDevmode = function () {
var jsonParameterDef = CreateJsonObject(driverPropertyBag, "ParameterDef");
if (jsonParameterDef) {
var arrayParameterDef = jsonParameterDef.parameterDef;

// Get all items deefined by DriverPropertyBag, Search item from PrintTicket.
for (var i = 0, jsonParameterDefLength = arrayParameterDef.length; i < jsonParameterDefLength; i++) {
var orgParameterInitName = arrayParameterDef[i].name;
var parameterInitName = GetSchemaName(orgParameterInitName);
var parameterInitNSPrefix = GetSchemaPrefix(orgParameterInitName);
var parameterInitNSUri = nsObj[parameterInitNSPrefix];
var ptParameterInitNode = GetParamInit(ptNode, parameterInitNSUri, parameterInitName);

if (ptParameterInitNode) {
var parameterInitValueNode = ptParameterInitNode.firstChild;
var parameterInitText = parameterInitValueNode.text;

// check PT Value
checkParameter();

// Set ParameterInit Value in DEVMODE.
try {
if (devModeProperties.GetString(parameterInitName) != parameterInitText) {
devModeProperties.SetString(parameterInitName, parameterInitText);
}
}
catch (errorObject) {
Debug.writeln("Set DEVMODE PropertyBag error : " + parameterInitName + errorObject.message);
}
}
}
}
}

上記のようなコードを実装することで、PrintTicketの値をDEVMODEに登録することができる。
・validatePrintTicket
本関数では、PrintTicketの値の精査を行う関数である。本実施形態では主に以下の機能を有する。

setDevmode = function () {
var jsonParameterDef = CreateJsonObject (driverPropertyBag, "ParameterDef");
if (jsonParameterDef) {
var arrayParameterDef = jsonParameterDef.parameterDef;

// Get all items deefined by DriverPropertyBag, Search item from PrintTicket.
for (var i = 0, jsonParameterDefLength = arrayParameterDef.length; i <jsonParameterDefLength; i ++) {
var orgParameterInitName = arrayParameterDef [i] .name;
var parameterInitName = GetSchemaName (orgParameterInitName);
var parameterInitNSPrefix = GetSchemaPrefix (orgParameterInitName);
var parameterInitNSUri = nsObj [parameterInitNSPrefix];
var ptParameterInitNode = GetParamInit (ptNode, parameterInitNSUri, parameterInitName);

if (ptParameterInitNode) {
var parameterInitValueNode = ptParameterInitNode.firstChild;
var parameterInitText = parameterInitValueNode.text;

// check PT Value
checkParameter ();

// Set ParameterInit Value in DEVMODE.
try {
if (devModeProperties.GetString (parameterInitName)! = parameterInitText) {
devModeProperties.SetString (parameterInitName, parameterInitText);
}
}
catch (errorObject) {
Debug.writeln ("Set DEVMODE PropertyBag error:" + parameterInitName + errorObject.message);
}
}
}
}
}

By implementing the above code, the value of PrintTicket can be registered in DEVMODE.
-ValidatePrintTicket
This function is a function for examining the value of PrintTicket. The present embodiment mainly has the following functions.

− PrintTicketのParameterInitにおける上限値・下限値チェック
− PrintTicketのParameterInitにおける空文字チェック
本関数では、PrintTicketに関する項目についてParameterの上限値・下限値のチェックおよび、値が空であった場合のParameterの削除を行う。上限値・下限値のチェックに関しては、前述しているため省略する。次に、Parameterの空文字のチェックを行う。対象となるPrintTicketに対して、ParameterInitをすべて探索し、ParameterInitのパラメータ値が空であるかどうかを判断する。もし、空であると判断した場合は、対象のParameterInitを削除する。これを検索で見つかったParameterInitすべてに対して精査を行う。以下がそのソースコードとなる。
-Check upper and lower limit values in PrintTicket's ParameterInit-Check empty characters in PrintTicket's ParameterInit This function checks the upper and lower limit values of Parameter for items related to PrintTicket and deletes the Parameter if the value is empty . The check on the upper limit value and the lower limit value is omitted because it has been described above. Next, the empty character of Parameter is checked. All ParameterInit is searched for the target PrintTicket, and it is determined whether or not the parameter value of ParameterInit is empty. If it is determined to be empty, the target ParameterInit is deleted. This is examined for all ParameterInit found in the search. The following is the source code.


deleteEmptyParameterInit = function () {
// Count PrintTicket Feature
var countNum = ptNode.childNodes.length;
for (var i = 0; i < countNum; i++) {
var node = ptNode.childNodes[i];
if (node.nodeName == "psf:ParameterInit") {
if (node.firstChild.text == "") {

// If ParameterRef contains, delete ParameterRefNode.
var ParamRefName = GetSchemaName(node.attributes[0].text);
var ParamRefNSPrefix = GetSchemaPrefix(node.attributes[0].text);
var paramRefNSUri = nsObj[ParamRefNSPrefix]

var paramRefNode = GetParameterRef(ptNode, paramRefNSUri, ParamRefName);
if (paramRefNode) {
ptNode.removeChild(paramRefNode);
}
ptNode.removeChild(node);

// ChildNode carries by deleting, so reduce countNum.
i--;
countNum--;

retVal = 1;
}
}
}
return retVal;
}

上記のようなコードを実装することで、PrintTicketの精査処理を行うことができる。

deleteEmptyParameterInit = function () {
// Count PrintTicket Feature
var countNum = ptNode.childNodes.length;
for (var i = 0; i <countNum; i ++) {
var node = ptNode.childNodes [i];
if (node.nodeName == "psf: ParameterInit") {
if (node.firstChild.text == "") {

// If ParameterRef contains, delete ParameterRefNode.
var ParamRefName = GetSchemaName (node.attributes [0] .text);
var ParamRefNSPrefix = GetSchemaPrefix (node.attributes [0] .text);
var paramRefNSUri = nsObj [ParamRefNSPrefix]

var paramRefNode = GetParameterRef (ptNode, paramRefNSUri, ParamRefName);
if (paramRefNode) {
ptNode.removeChild (paramRefNode);
}
ptNode.removeChild (node);

// ChildNode carries by deleting, so reduce countNum.
i--;
countNum--;

retVal = 1;
}
}
}
return retVal;
}

By implementing the code as described above, it is possible to perform a print ticket scrutiny process.

以上の処理を行うことで、PrintCapabilitesおよびPrintTicketに対して、効率的に印刷設定情報を編集することができる。   By performing the above processing, it is possible to efficiently edit the print setting information for PrintCapabilities and PrintTicket.

101 CPU、102 主記憶装置、1021 ROM、1022 RAM、
105 補助記憶装置
101 CPU, 102 main storage, 1021 ROM, 1022 RAM,
105 Auxiliary storage device

Claims (1)

XML形式で記述された印刷設定能力情報および印刷設定情報を用いた印刷設定変更機能を有するプリンタードライバーが提供する印刷設定編集モジュールにおいて、
機種依存情報を保持しているデータファイルからパラメータ情報を取得する手段と、
パラメータ情報を利用して、印刷設定能力情報および印刷設定情報を編集する手段と、
ユーザーが設定した印刷設定に応じて、印刷設定能力情報および印刷設定情報を編集する手段と、
印刷設定情報の値をDEVMODEに登録する手段と、
DEVMODEに登録された値を印刷設定情報に反映する手段を有し、
これらの処理を膨大な印刷設定情報においても効率的に行うことを特徴とするプログラム。
In the print setting editing module provided by the printer driver having the print setting capability information described in the XML format and the print setting changing function using the print setting information,
Means for obtaining parameter information from a data file holding model-dependent information;
Means for editing print setting capability information and print setting information using parameter information;
A means for editing the print setting capability information and the print setting information according to the print settings set by the user;
Means for registering the value of the print setting information in DEVMODE;
Means for reflecting the value registered in DEVMODE in the print setting information;
A program characterized by efficiently performing these processes even for a large amount of print setting information.
JP2014109630A 2014-05-28 2014-05-28 Program for efficiently editing print setting information Pending JP2015225481A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014109630A JP2015225481A (en) 2014-05-28 2014-05-28 Program for efficiently editing print setting information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014109630A JP2015225481A (en) 2014-05-28 2014-05-28 Program for efficiently editing print setting information

Publications (1)

Publication Number Publication Date
JP2015225481A true JP2015225481A (en) 2015-12-14

Family

ID=54842180

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014109630A Pending JP2015225481A (en) 2014-05-28 2014-05-28 Program for efficiently editing print setting information

Country Status (1)

Country Link
JP (1) JP2015225481A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3293627A1 (en) 2016-09-08 2018-03-14 Ricoh Company, Ltd. Printer driver, information processing apparatus, and image processing system
US10025537B2 (en) 2016-07-21 2018-07-17 Ricoh Company, Ltd. Information processing apparatus having combined model common function file and model specific function file, information processing system, information processing method, and recording medium
US10191697B2 (en) 2017-03-17 2019-01-29 Ricoh Company Ltd. Information processing apparatus, information processing system, and information processing method
US10445027B2 (en) 2017-09-29 2019-10-15 Brother Kogyo Kabushiki Kaisha Non-transitory computer-readable medium storing instructions realizing graphical object processor, and method of controlling information processing device
JP2020009055A (en) * 2018-07-05 2020-01-16 キヤノン株式会社 Information processing device and program

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10025537B2 (en) 2016-07-21 2018-07-17 Ricoh Company, Ltd. Information processing apparatus having combined model common function file and model specific function file, information processing system, information processing method, and recording medium
EP3293627A1 (en) 2016-09-08 2018-03-14 Ricoh Company, Ltd. Printer driver, information processing apparatus, and image processing system
US10275192B2 (en) 2016-09-08 2019-04-30 Ricoh Company, Ltd. Information processing apparatus, image processing system, and printer driver
US10191697B2 (en) 2017-03-17 2019-01-29 Ricoh Company Ltd. Information processing apparatus, information processing system, and information processing method
US10445027B2 (en) 2017-09-29 2019-10-15 Brother Kogyo Kabushiki Kaisha Non-transitory computer-readable medium storing instructions realizing graphical object processor, and method of controlling information processing device
US10860264B2 (en) 2017-09-29 2020-12-08 Brother Kogyo Kabushiki Kaisha Non-transitory computer-readable medium storing instructions realizing graphical object processor, and method of controlling information processing device
JP2020009055A (en) * 2018-07-05 2020-01-16 キヤノン株式会社 Information processing device and program
JP7171272B2 (en) 2018-07-05 2022-11-15 キヤノン株式会社 Information processing device and program

Similar Documents

Publication Publication Date Title
US10365867B2 (en) Printer and server
US8373874B2 (en) Using a web browser on a client to enable and disable a filter program on a printer
KR100576030B1 (en) A printing system
US8804172B2 (en) Non-transitory computer readable recording medium stored with printer driver updating program and printer driver updating method
US7403297B2 (en) Printing system that manages font resources using system independent resource references
JP5293035B2 (en) Data processing apparatus, data processing method, program, and recording medium
JP2009271930A (en) Method, system and program for generating jdf by use of printer definition file
JP2002268847A (en) Printing system and method for customization of print job
JP2015225481A (en) Program for efficiently editing print setting information
JP5581793B2 (en) Information processing apparatus, program, and storage medium
JP5261250B2 (en) Print data processing apparatus, method, and computer-readable medium for processing page description language
US8699076B2 (en) Image forming apparatus, server, image forming system, and storage medium, outputting superimposed text strings in a variable form page
US11520536B2 (en) Information processing apparatus, control method and program therefor, and server system capable of communicating with the information processing apparatus
JP2012252434A (en) Information processing apparatus and information processing method
JP2015121974A (en) Information processor, information processing method, and program
JP2017033052A (en) Control device and program in image forming apparatus
JP5871521B2 (en) Print data processing method, print data processing apparatus and program
JP6833419B2 (en) Information processing equipment, methods and programs
JP6827738B2 (en) Control methods, programs and information processing equipment
JP6234417B2 (en) Information processing apparatus, control method therefor, and program
JP6437076B2 (en) Information processing apparatus, control method therefor, and program
JP3399461B2 (en) Printing system
JP7124447B2 (en) Translators, printing systems and programs
JP5600960B2 (en) Host computer, print data generation method and program
JP4861841B2 (en) Print data generation apparatus, print data generation method, printer driver program, document data generation server, document data generation method, document data generation program, and print data generation system