A method and terminal for intelligent conversion of print data format based on XFS
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-26
- Publication Date
- 2026-08-14
AI Technical Summary
[0007]而每次与新应用程序方联调、或者应用程序方增加新要求时,都要修改代码实现,作为驱动层对接的应用特别多,单纯修改代码不利于维护版本,且每次修改代码后需要做很多测试,浪费人力物力
[0016] The beneficial effects of this invention are as follows: This invention provides an intelligent printing data format conversion method and terminal based on XFS. A data conversion module parses, converts, and encapsulates the raw printing data sent by the application according to a configuration file, outputting the final printing data in a format that the printing device can print. In other words, the data conversion module intelligently completes the parsing of the printing data format using a data conversion function module plus a configuration file, greatly reducing the amount of code development. The configuration file stores the configuration information required for the printing data parsing, format conversion, and data encapsulation process, facilitating rapid adaptation to printing devices from different manufacturers. The functionality is flexible and configurable, avoiding the drawback of having to redevelop code to parse the printing data format and correctly send the printing fields to the printing device every time different applications are connected during manufacturer integration testing.
Smart Images

Figure CN115639973B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of financial IT technology, and in particular to an intelligent conversion method and terminal for print data format based on XFS. Background Technology
[0002] The development of financial IT technology has made self-service equipment one of the important channels for banks' retail business. In recent years, banks have gradually changed their business philosophy, vigorously developing various value-added services and intermediary services on the basis of traditional deposit and loan business. As a result, the demand for self-service equipment has continued to increase, the functions of self-service equipment have been continuously expanded, and the frequency of use and transaction volume of self-service equipment have reached unprecedented heights.
[0003] The CEN / XFS (European Committee for Standardization / Financial Expansion Services) standard, as an internationally recognized standard for financial self-service equipment, has been increasingly adopted by banking institutions in China in recent years. In particular, unified self-service terminal platforms and intelligent monitoring and management systems for branch services are developed based on this standard, which places high demands on a wide range of self-service system integrators.
[0004] The CEN / XFS standard provides a set of interface specifications for driving financial devices. As long as any manufacturer's hardware software driver conforms to this specification, its hardware can be seamlessly connected to other systems that also conform to this specification without any software modifications.
[0005] like Figure 1 As shown, the CEN / XFS standard stipulates that self-service device applications must call a unified application programming interface (API), and requires self-service device hardware manufacturers to provide a unified device driver interface (SPI). The two interact through the XFS Manager provided by CEN / XFS. The XFS Manager finds the corresponding device driver by querying the registry configuration information, converts the API interface command data called by the application into the corresponding SPI interface data, and forwards it to the designated device driver for processing.
[0006] Currently, during integration testing between the application layer and vendor drivers based on the CEN / XFS standard, the format of the print data sent by the printer module is not clearly defined. This format is highly dependent on the current application environment; different applications may use different data formats, such as JSON, XML, or even unformatted strings (where different fields are separated by a specified delimiter). This situation leads to a situation where, during vendor integration testing, each time a different business system application is connected, the application provider must first provide its own documentation to confirm the data format sent by the application. Then, the code must be modified accordingly to provide a complete and stable format parsing interface to meet the required format parsing. Each time a different business system application is connected, the code must be modified again to adapt to the print data format parsing function before the print fields can be correctly sent to the printer for printing.
[0007] Every time we need to integrate with a new application or when the application adds new requirements, we have to modify the code implementation. Since there are many applications that interface with the driver layer, simply modifying the code is not conducive to maintaining the version, and a lot of testing is required after each code modification, which wastes manpower and resources. Summary of the Invention
[0008] The technical problem to be solved by this invention is to provide an intelligent conversion method and terminal for print data format based on XFS, which can be quickly adapted to the printer function modules of different applications and greatly reduce the amount of code development.
[0009] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0010] A method for intelligent conversion of print data format based on XFS, comprising the following steps:
[0011] S1. Obtain the raw print data sent by the application;
[0012] S2. Input the raw print data into the data conversion module. The data conversion module parses, converts and encapsulates the raw print data according to the preset configuration file, and outputs the final print data to the manufacturer's SP interface.
[0013] S3. The SP interface calls the driver of the printing device to send the final print data to the printing device for printing.
[0014] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows:
[0015] An XFS-based intelligent conversion terminal for print data formats includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the XFS-based intelligent conversion method for print data formats as described above.
[0016] The beneficial effects of this invention are as follows: This invention provides an intelligent printing data format conversion method and terminal based on XFS. A data conversion module parses, converts, and encapsulates the raw printing data sent by the application according to a configuration file, outputting the final printing data in a format that the printing device can print. In other words, the data conversion module intelligently completes the parsing of the printing data format using a data conversion function module plus a configuration file, greatly reducing the amount of code development. The configuration file stores the configuration information required for the printing data parsing, format conversion, and data encapsulation process, facilitating rapid adaptation to printing devices from different manufacturers. The functionality is flexible and configurable, avoiding the drawback of having to redevelop code to parse the printing data format and correctly send the printing fields to the printing device every time different applications are connected during manufacturer integration testing. Attached Figure Description
[0017] Figure 1 A block diagram illustrating the data transmission principles between CEN / XFS standard applications and self-service device hardware manufacturers;
[0018] Figure 2 This is an overall flowchart of an XFS-based intelligent conversion method for print data formats according to an embodiment of the present invention.
[0019] Figure 3 This is a flowchart of step S2 in an XFS-based intelligent conversion method for print data formats according to an embodiment of the present invention.
[0020] Figure 4 This is a schematic diagram of the structure of an XFS-based intelligent conversion terminal for print data formats according to an embodiment of the present invention.
[0021] Label Explanation:
[0022] 1. An intelligent conversion terminal for print data formats based on XFS; 2. Memory; 3. Processor. Detailed Implementation
[0023] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0024] Prior to this, the English abbreviations and technical terms used in this invention are defined as follows:
[0025] 1. XFS, Extensions for Financial Services, was released by the Banking Solutions Providers Association on May 24, 1993. It mainly specifies a client / server architecture financial enterprise computing environment based on the MS Windows platform.
[0026] 2. JSON, JavaScript Object Notation, is a lightweight data interchange format;
[0027] 3. XML, Extensible Markup Language, is a markup language used to mark up electronic documents to give them structure.
[0028] 4. Manufacturer SP Interface: The interface provided by the manufacturer for the printing device, used to call the printing driver of the printing device to perform printing jobs.
[0029] Please refer to Figures 1 to 3 A method for intelligent conversion of print data format based on XFS, comprising the following steps:
[0030] S1. Obtain the raw print data sent by the application;
[0031] S2. Input the original print data into the data conversion module for format conversion, and output the final print data to the manufacturer's SP interface. The data conversion module is integrated into the SP interface and contains a configuration file for parsing, converting and encapsulating the print data.
[0032] S3. The SP interface calls the driver of the printing device to send the final print data to the printing device for printing.
[0033] As described above, the beneficial effects of this invention are as follows: By employing a data conversion module to parse, convert, and encapsulate the raw print data sent by the application according to the configuration file, the final print data in a format that the printing device can print is output. That is, in the form of a data conversion module + configuration file, the data conversion module intelligently completes the parsing of the print data format, greatly reducing the amount of code development. Furthermore, the introduction of the configuration file saves the configuration information required for the parsing, format conversion, and data encapsulation process of print data in the form of a configuration file, which facilitates quick adaptation to printing devices from different manufacturers. The function is flexible and configurable, avoiding the defect that during manufacturer joint debugging and testing, code must be redeveloped each time different applications are connected to parse the print data format before the print fields can be correctly sent to the printing device.
[0034] Further, step S1 specifically includes:
[0035] The API interface is called to transmit the print data issued by the application to the XFS Manager. The XFS Manager queries the registry configuration to find the corresponding manufacturer, and calls the corresponding SPI interface to transmit the print data to the manufacturer's SP interface to obtain the original print data.
[0036] As described above, the CEN\XFS standard stipulates that applications must call a unified application interface (API), and requires hardware manufacturers of self-service printing devices to provide a unified device driver interface (SPI). The two interact through the XFS Manager, which queries the registry configuration to find the device driver corresponding to the manufacturer's device, converts the API interface command data called by the application into the corresponding SPI interface data, and forwards it to the designated manufacturer's device driver for further processing.
[0037] Furthermore, step S2 specifically includes the following steps:
[0038] S21. In the data conversion module, pre-configure the field information required for parsing and encapsulating print data in different input formats, and configure the output format of the final print data to obtain a configuration file;
[0039] S22. Input the original print data into the data conversion module, and the data conversion module intelligently determines the input format of the original print data based on the content of the original print data;
[0040] S23. Read the corresponding configuration information in the configuration file according to the input format to obtain the actual print data;
[0041] S24. Read the output format in the configuration file, encapsulate the actual print data according to the output format, and obtain the final print data;
[0042] S25. The data conversion module outputs the final print data to the SP interface.
[0043] As described above, the configuration file is pre-configured in the data conversion module. After obtaining the original print data, the data conversion module can directly call the configuration file to obtain the configuration information required for format conversion, and quickly convert the original print data into a new format without requiring extensive code modifications, which facilitates rapid integration with different printing devices.
[0044] Furthermore, both the input format and the output format include JSON, XML, and strings;
[0045] The field information includes node fields and key-value fields. The node fields include GLOBAL, INPUT_JSON, INPUT_XML, INPUT_STRING, and OUTPUT_STRING. The key-value fields include DataFormat, Path, Separator, and Connector.
[0046] As described above, the input and output formats include JSON, XML, and strings, and it supports mutual conversion between printed data in JSON, XML, and string formats.
[0047] Furthermore, in step S21, the field information required for parsing and encapsulating print data in different input formats is pre-configured, specifically as follows:
[0048] If the input format is JSON, then according to the position of the fields to be printed in the original print data, the key-value field "Path" in the node field "INPUT_JSON" is assigned values sequentially, in the format "node KEY value 1 / array index value 1, node KEY value 2 / array index value 2, ...", until each field is assigned a value. The separator "," indicates the separation of each layer of JSON child nodes or each layer of array index.
[0049] If the input format is XML, then according to the position of the fields to be printed in the original print data, the key-value field "Path" in the node field "INPUT_XML" is assigned values sequentially, in the format "node KEY value 1, node KEY value 2, ...", until each field is assigned a value. The separator "," indicates the division of each level of XML child nodes.
[0050] If the input format is a string, then according to the position of the fields to be printed in the original print data, values are sequentially assigned to the key-value field "Path" in the node field "INPUT_STRING", in the format "node KEY value 1, node KEY value 2, ...", until each field is assigned a value. Then, symbolic values are assigned to the key-value fields "Separator" and "Connector" in the node field "INPUT_STRING", with the separator "," indicating the division of each level of string child nodes.
[0051] The value of the key-value field "Path" indicates the actual position of the actual printed data in the original printed data, the value of the key-value field "Separator" indicates the connector between multiple actual printed data, and the value of the key-value field "Connector" indicates the connector between the label and the value within each actual printed data.
[0052] As described above, since the actual printed data in the original printed data may be the entire original printed data or only a small part of the entire original printed data, the key-value fields of different nodes in the field information are assigned corresponding values not only by the different input formats, but also according to the actual position of the actual printed data in the original printed data. This forms a configuration file containing different field information corresponding to different input formats, ensuring that the actual printed data can be obtained directly by reading the values of the key-value fields, thus avoiding invalid printing of non-printable fields.
[0053] Furthermore, the key-value fields “Separator” and “Connector” are assigned values using different symbols.
[0054] As described above, the key-value fields “Separator” and “Connector” cannot use the same symbol, in order to distinguish between fields, labels and values in the actual printed data.
[0055] Furthermore, in step S21, configuring the output format of the final printed data specifically involves:
[0056] The output format of the final printed data is determined according to the driver requirements of the manufacturer's printing equipment. If the driver of the printing equipment requires the output format to be JSON, then the key-value field "DataFormat" of the node field "GLOBAL" is assigned the value JSON, so that "DataFormat = JSON".
[0057] If the driver of the printing device requires the output format to be XML, then assign the value JSON to the key-value field "DataFormat" of the node field "GLOBAL", so that "DataFormat = XML";
[0058] If the driver of the printing device requires the output format to be a string, then the value of the key field "DataFormat" of the node field "GLOBAL" is assigned to STRING, so that "DataFormat = STRING".
[0059] As described above, the final output format of the printed data needs to be determined according to the driver requirements of the printing device so that the format of the converted printed data meets the output requirements of the printing device. After the output format is determined, the node fields and key-value fields corresponding to different output formats can be assigned values in the configuration file so that the configuration file can be directly called to encapsulate the actual printed data in the appropriate format and output it to the printing device for printing.
[0060] Furthermore, step S23 specifically includes:
[0061] If the input format is JSON, then the values of the key-value field "Path" in the node field "INPUT_JSON" in the configuration file are read sequentially, and the actual printed data is obtained by parsing.
[0062] If the input format is XML, the values of the key-value field "Path" in the node field "INPUT_XML" of the configuration file are read sequentially, and the actual print data is obtained by parsing.
[0063] If the input format is a string, the value of the key field "Path" in the node field "INPUT_STRING" of the configuration file is read sequentially to obtain the actual printed word, and the symbol values in the key fields "Separator" and "Connector" in the node field "INPUT_STRING" are read.
[0064] Further, step S24 specifically includes:
[0065] If "DataFormat=JSON", then the actual printed data will be encapsulated and the final printed data will be output in single-layer JSON format;
[0066] If "DataFormat=XML", then the actual printed data will be encapsulated and the final printed data will be output in a single-layer XML format;
[0067] If "DataFormat = STRING", then the symbol values of the key fields "Separator" and "Connector" in the node field "OUTPUT_STRING" will be placed between each field and between each label and value in the actual printed data, respectively, and then encapsulated to output the final printed data in string format.
[0068] As described above, parsing the actual printed data from the original print data and encapsulating it in the corresponding output format can be determined by reading the values of "Path" and "DataFormat" in the key-value fields of the pre-configured number in the configuration file layer by layer. This not only allows for efficient and stable acquisition of the actual print data, but also provides flexibility and convenience. When the application or printing device changes, i.e., when the original print data or manufacturer changes, only the values in the key-value fields need to be modified accordingly, without the need to modify a large amount of code, making it easy to quickly adapt to different application printing devices.
[0069] Furthermore, the data conversion module is integrated into the SP interface;
[0070] The configuration file is saved in INI format.
[0071] As described above, the data conversion module is integrated into the manufacturer's SP interface, which improves the efficiency of parsing, converting and encapsulating raw data. At the same time, the configuration file is saved in INI format, which is suitable for most terminal devices, easy to read, and occupies little memory.
[0072] Please refer to Figure 4 An XFS-based intelligent conversion terminal for print data formats includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the XFS-based intelligent conversion method for print data formats as described above.
[0073] As described above, the beneficial effects of this invention are as follows: Based on the same technical concept, and in conjunction with the aforementioned intelligent conversion method for print data formats based on XFS, an intelligent conversion terminal for print data formats based on XFS is provided. By employing a data conversion module to parse, convert, and encapsulate the raw print data sent by the application according to a configuration file, the final print data in a format that the printing device can print is output. That is, in the form of a data conversion function module + configuration file, the data conversion module intelligently completes the parsing of print data formats, greatly reducing the amount of code development. Furthermore, the introduction of a configuration file saves the configuration information required for the parsing, format conversion, and data encapsulation process of print data in the form of a configuration file, which facilitates quick adaptation to and integration with printing devices from different manufacturers. The functions are flexible and configurable, avoiding the defect that during manufacturer joint debugging and testing, code must be redeveloped each time different applications are integrated to parse the print data format before the print fields can be correctly sent to the printing device.
[0074] This invention provides an intelligent conversion method and terminal for print data format based on XFS, which is applicable to the conversion of print data format so as to be compatible with the print drivers of different manufacturers' printing devices for printing. The following is a detailed description with reference to the embodiments.
[0075] Please refer to Figure 2 Embodiment 1 of the present invention is as follows:
[0076] A method for intelligent conversion of print data formats based on XFS, such as... Figure 2 As shown, the steps include:
[0077] S1. Obtain the raw print data sent by the application.
[0078] S2. Input the raw print data into the data conversion module. The data conversion module parses, converts and encapsulates the raw print data according to the preset configuration file, and outputs the final print data to the manufacturer's SP interface.
[0079] In this embodiment, the data conversion module is integrated into the SP interface.
[0080] The S3 and SP interfaces call the printer driver to send the final print data to the printer for printing.
[0081] In this embodiment, the data conversion module is integrated into the manufacturer's SP interface. Combined with a configuration file, the raw print data sent by the application is parsed, converted, and encapsulated to output the final print data in a format that the printing device can print. In other words, the data conversion module intelligently completes the parsing of print data formats, greatly reducing the amount of code development. The configuration file is introduced to save the configuration information required for the parsing, format conversion, and data encapsulation process of print data. This facilitates quick adaptation to printing devices from different manufacturers, and the functions are flexible and configurable. It avoids the defect that during manufacturer joint testing, code must be redeveloped each time different applications are connected to parse the print data format before the print fields can be correctly sent to the printing device.
[0082] Please refer to Figure 1 and Figure 3 Embodiment two of the present invention is as follows:
[0083] A method for intelligent conversion of print data format based on XFS, in this embodiment, step S1 specifically includes:
[0084] The API interface is called to send the print data sent by the application to the XFS Manager. The XFS Manager queries the registry configuration to find the corresponding manufacturer, calls the corresponding SPI interface to send the print data to the manufacturer's SP interface, and obtains the raw print data.
[0085] That is, Figure 1 As shown in this embodiment, the CEN / XFS standard stipulates that applications must call a unified application interface (API), and also requires hardware manufacturers of self-service printing devices to provide a unified device driver interface (SPI). The two interact through the XFS Manager, which queries the registry configuration to find the device driver corresponding to the manufacturer, converts the API interface command data called by the application into the corresponding SPI interface data, and forwards it to the device driver of the specified manufacturer for further processing, thereby obtaining the original print data.
[0086] In this embodiment, Example 1 is provided, assuming that the obtained original print data is as follows:
[0087] {
[0088] "DATA":[{
[0089] "Additional": "Additional information content"
[0090] },{
[0091] ProjectName":"xxxxx project",
[0092] "ProjectTime":"2022.07.15"
[0093] }],
[0094] "Other": "Other data"
[0095] }
[0096] The actual printed data is as follows:
[0097] {
[0098] ProjectName":"xxxxx project",
[0099] "ProjectTime":"2022.07.15"
[0100] }
[0101] Example 2 is provided, assuming the original print data obtained is as follows:
[0102] <root>
[0103] <additional> Additional information< / additional>
[0104] <data>
[0105] <projectname> xxxxx project< / projectname>
[0106] <projecttime> 2022.07.15< / projecttime>
[0107] < / data>
[0108] < / root>
[0109] The actual printed data is as follows:
[0110] <projectname> xxxxx project< / projectname>
[0111] <projecttime> 2022.07.15< / projecttime>
[0112] like Figure 2 As shown, step S2 specifically includes the following steps:
[0113] S21. In the data conversion module, pre-configure the field information required for parsing and encapsulating print data in different input formats, and configure the output format of the final print data to obtain the configuration file;
[0114] In this embodiment, the configuration file is saved in INI format, which is applicable to most terminal devices, easy to read, and occupies little memory. At the same time, both the input and output formats include JSON, XML, and string, and can support mutual conversion between printed data in JSON, XML, and string formats. The field information includes node fields and key-value fields. The node fields include GLOBAL, INPUT_JSON, INPUT_XML, INPUT_STRING, and OUTPUT_STRING, and the key-value fields include DataFormat, Path, Separator, and Connector.
[0115] S22. Input the original print data into the data conversion module, which intelligently determines the input format of the original print data based on its content.
[0116] S23. Read the corresponding configuration information in the configuration file according to the input format to obtain the actual print data.
[0117] S24. Read the output format in the configuration file, encapsulate the actual print data according to the output format, and obtain the final print data.
[0118] S25, The data conversion module outputs the final print data to the SP interface.
[0119] In this embodiment, the configuration file is pre-configured in the data conversion module. After obtaining the original print data, the data conversion module can directly call the configuration file to obtain the configuration information required for format conversion, and quickly convert the original print data into a format without making a lot of code modifications, which facilitates quick connection to different printing devices.
[0120] In this embodiment, the output format of the final printed data is configured in step S21, specifically as follows:
[0121] The final output format of the printed data is determined according to the driver requirements of the manufacturer's printing equipment, where the key-value field of the node field "GLOBAL" is "DataFormat".
[0122] If the printer driver requires the output format to be JSON, then assign the value JSON to the key-value field "DataFormat" of the node field "GLOBAL", so that "DataFormat = JSON".
[0123] If the printer driver requires the output format to be XML, then assign the value JSON to the key-value field "DataFormat" of the node field "GLOBAL", so that "DataFormat = XML".
[0124] If the printer driver requires the output format to be a string, then assign the value STRING to the key field "DataFormat" of the node field "GLOBAL", making "DataFormat = STRING".
[0125] In Example 1 above, if the printer driver requires the output format to be a string, then the final print data output format should be configured in the configuration file as follows:
[0126] [GLOBAL]
[0127] DataFormat=STRING
[0128] In Example 2 above, if the printer driver requires JSON as the output format, then the final output format of the printed data should be configured in the configuration file as follows:
[0129] [GLOBAL]
[0130] DataFormat = JSON
[0131] Meanwhile, in this embodiment, step S21 pre-configures the field information required for parsing and encapsulating print data in different input formats, specifically as follows:
[0132] First, let's explain the input data configuration information. When the input format is JSON, the value of the key-value field "Path" needs to be configured in the node field "INPUT_JSON". Its value represents the actual position of the printed data within the original printed data, in the format "node KEY value 1 / array index value 1, node KEY value 2 / array index value 2, ...". The purpose of configuring this field is that the actual printed data may be only a small part of the original printed data, or the entire original printed data may be the actual printed data. When the input original printed data is entirely the actual printed data, the key-value field "Path" in "INPUT_JSON" does not need to be configured. When the actual printed data is only a small part of the original printed data, in subsequent step S23, the data conversion module needs to parse it according to the configured key-value. The value of the key-value field "Path" in "INPUT_JSON" is configured according to the input data format JSON. Due to the nesting of JSON data, each level may be a JSON child node or an array. Therefore, the value of the key-value field "Path" uses a comma to separate the JSON child node KEY value or array index.
[0133] In Example 1 above, if the data conversion module recognizes that the input format of the original printed data is JSON, then the following configuration will be performed:
[0134] [INPUT_JSON]
[0135] Path = DATA, 1
[0136] Here, "DATA" indicates that the first sub-layer is a JSON-formatted child node with the node KEY value "DATA", and "1" indicates that the second sub-layer is an array, with the actual printed data located in the array at index "1". Therefore, in step S23, the data conversion module will sequentially find the first-layer JSON-formatted child node with the node KEY value "DATA", then traverse the second-layer data to find the data at index "1", thus obtaining the actual printed data.
[0137] If the input format is XML, the value of the key-value field "Path" needs to be configured in the node field "INPUT_XML". Its value represents the actual position of the printed data within the original printed data, in the format "node KEY value 1, node KEY value 2, ...". The purpose of configuring this field is that the actual printed data may be only a small part of the original printed data, or the entire original printed data may be the actual printed data. When all the input data is actual printed data, the key-value field "Path" in "INPUT_XML" does not need to be configured. When the actual printed data is only a small part of the original printed data, in subsequent step S23, the data conversion module needs to parse according to the configured key-value. The value of the key-value field "Path" in "INPUT_XML" is configured according to the input data format XML. Similarly, since XML format data can be nested, with each level potentially being an XML child node, the value of the key-value field "Path" uses a comma to separate the KEY values of each XML child node.
[0138] In Example 2 above, if the data conversion module recognizes that the input format of the original print data is XML, then the following configuration will be performed:
[0139] [INPUT_XML]
[0140] Path = ROOT,DATA
[0141] Where “ROOT” indicates that the KEY value of the first sub-layer node is “ROOT” and “DATA” indicates that the KEY value of the second sub-layer node is “DATA”, then in step S23 the data conversion module will find the first layer data with the node KEY value of “ROOT” in sequence, and then find the second layer data with the node KEY value of “DATA”, thereby obtaining the actual printed data.
[0142] If the input format is a string, the value of the key-value field "Path" needs to be configured in the node field "INPUT_STRING", in the format "node KEY value 1, node KEY value 2, ...". Similar to JSON and XML formats, the delimiter "," indicates the separation of string child nodes at each level. Additionally, the values of the key-value fields "Separator" and "Connector" also need to be configured in the node field "INPUT_STRING". The key-value field "Separator" represents the connector between multiple actual printed data, and the value of the key-value field "Connector" represents the connector between labels and values within each actual printed data. In this embodiment, it is worth noting that in this embodiment, the key-value fields "Separator" and "Connector" are assigned different symbols to distinguish between fields, labels, and values in the actual printed data.
[0143] Since the actual printed data in the original print data may be the entire original print data or only a small part of it, the key-value fields of different nodes in the field information are assigned corresponding values not only according to the different input formats, but also according to the actual position of the actual printed data in the original print data. This forms a configuration file containing different field information corresponding to different input formats, ensuring that the actual printed data can be obtained directly by reading the values of the key-value fields, thus avoiding invalid printing of non-printable fields.
[0144] Next, the configuration information of the output data is explained. The output format is determined according to the key-value field "DataFormat" in the node field "GLOBAL". If the output format is JSON, no configuration is required. The subsequent data conversion module only needs to read the value of the key-value field "Path" in the node field "INPUT_JSON" in the configuration file in sequence, and after parsing the actual print data, the actual print data is directly encapsulated in step S24 to output the final print data in single-layer JSON format.
[0145] If the output format is XML, no configuration is required. The subsequent data conversion module only needs to read the value of the key-value field "Path" in the node field "INPUT_XML" in the configuration file in sequence, and after parsing the actual print data, directly encapsulate the actual print data in step S24 to output the final print data in single-layer XML format.
[0146] If the output format is a string, the data conversion module needs to read the value of the key-value field "Path" in the node field "INPUT_STRING" in the configuration file in sequence and parse it to obtain the actual printed data. In step S24, it also needs to configure the values of the key-value fields "Separator" and "Connector" in the node field "OUTPUT_STRING" as configuration information, combine them with the actual printed data to encapsulate the data, and output the data in string form.
[0147] In Example 1 above, since the final output format is a string, the node field "OUTPUT_STRING" needs to be configured as follows:
[0148] [OUTPUT_STRING]
[0149] Separator = |
[0150] Connector ==
[0151] Here, "Separator=|" indicates that the connector between multiple actual printed data is "|", and "Connector==" indicates that the connector between the label and the value within each actual printed data is "=".
[0152] In Example 2 above, since the final output format is JSON, no configuration is required; the actual printed data can be directly encapsulated into JSON format for output.
[0153] Therefore, according to the above method, the actual printed data parsed in step S23 of Example 1 is as follows:
[0154] {
[0155] ProjectName":"xxxxx project",
[0156] "ProjectTime":"2022.07.15"
[0157] }
[0158] The actual printed data parsed in step S23 of Example 2 above is as follows:
[0159] <projectname> xxxxx project< / projectname>
[0160] <projecttime> 2022.07.15< / projecttime>
[0161] Simultaneously, step S24 reads the output format in the configuration file and, based on the corresponding configuration information (if the output format is JSON or XML, no configuration is required; if the output format is a string, the "Separator" and "Connector" of the node field "OUTPUT_STRING" need to be configured to obtain the assignment symbol), encapsulates the actual print data obtained in step S23 according to the output format to obtain the encapsulated final print data.
[0162] The final printed data output in Example 1 above is as follows:
[0163] "ProjectName = xxxxx Project | ProjectTime = 2022.07.15"
[0164] The final printed data output in Example 2 above is as follows:
[0165] {
[0166] ProjectName":"xxxxx project",
[0167] "ProjectTime":"2022.07.15"
[0168] }
[0169] This involves parsing the actual printed data from the raw print data and encapsulating it in the corresponding output format. This can be determined by reading the values of "Path", "DataFormat", "Separator" and "Connector" in the key-value fields configured in the configuration file layer by layer. This not only allows for efficient and stable acquisition of the actual print data, but also provides flexibility and convenience. When the application or printing device changes, i.e., when the raw print data or manufacturer changes, only the values in the key-value fields need to be modified accordingly, without the need to modify a large amount of code, making it easy to quickly adapt to different application printing devices.
[0170] Please refer to Figure 4 Embodiment 3 of the present invention is as follows:
[0171] An XFS-based intelligent conversion terminal for printing data formats 1 includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3. In this embodiment, when the processor 3 executes the computer program, it implements the steps of any one of the embodiments in Embodiments 1 to 3 described above.
[0172] In summary, the intelligent conversion method and terminal for print data format based on XFS provided by this invention has the following beneficial effects:
[0173] 1. Based on the process optimization approach of the printer module SP interface in the XFS command, an intelligent data conversion function module is introduced to intelligently complete the data conversion, which greatly reduces the amount of code development and saves manpower and material costs.
[0174] 2. The data conversion module, combined with a configuration file, saves essential field information for the parsing process in a configuration file format. Based on the characteristics of the data format, it parses the data layer by layer, enabling efficient and stable acquisition of actual print data. Its flexible and configurable features facilitate quick adaptation to drivers of different application printing devices.
[0175] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for intelligent conversion of print data format based on XFS, characterized in that, Including the following steps: S1. Obtain the raw print data sent by the application; S2. Input the raw print data into the data conversion module. The data conversion module parses, converts and encapsulates the raw print data according to the preset configuration file, and outputs the final print data to the manufacturer's SP interface. S3. The SP interface calls the printer driver to send the final print data to the printer for printing; Step S2 specifically includes the following steps: S21. In the data conversion module, pre-configure the field information required for parsing and encapsulating print data in different input formats, and configure the output format of the final print data to obtain a configuration file; S22. Input the original print data into the data conversion module, and the data conversion module intelligently determines the input format of the original print data based on the content of the original print data; S23. Read the corresponding configuration information in the configuration file according to the input format to obtain the actual print data; S24. Read the output format in the configuration file, encapsulate the actual print data according to the output format, and obtain the final print data; S25. The data conversion module outputs the final print data to the SP interface; Both the input format and the output format include JSON, XML, and strings; The field information includes node fields and key-value fields. The node fields include GLOBAL, INPUT_JSON, INPUT_XML, INPUT_STRING, and OUTPUT_STRING. The key-value fields include DataFormat, Path, Separator, and Connector.
2. The intelligent conversion method for print data format based on XFS according to claim 1, characterized in that, Step S1 specifically involves: The API interface is called to transmit the print data issued by the application to the XFS Manager. The XFS Manager queries the registry configuration to find the corresponding manufacturer, and calls the corresponding SPI interface to transmit the print data to the manufacturer's SP interface to obtain the original print data.
3. The intelligent conversion method for print data format based on XFS according to claim 1, characterized in that, In step S21, the pre-configured field information required for parsing and encapsulating print data in different input formats is specifically as follows: If the input format is JSON, then according to the position of the fields to be printed in the original print data, the key-value field "Path" in the node field "INPUT_JSON" is assigned values sequentially, in the format "node KEY value 1 / array index value 1, node KEY value 2 / array index value 2, ...", until each field is assigned a value. The separator "," indicates the division between each level of JSON child nodes or each level of array index. If the input format is XML, then according to the position of the fields to be printed in the original print data, the key-value field "Path" in the node field "INPUT_XML" is assigned values sequentially, in the format "node KEY value 1, node KEY value 2, ...", until each field is assigned a value. The separator "," indicates the division of each level of XML child nodes. If the input format is a string, then according to the position of the fields to be printed in the original print data, values are sequentially assigned to the key-value field "Path" in the node field "INPUT_STRING", in the format "node KEY value 1, node KEY value 2, ...", until each field is assigned a value. Then, symbol values are assigned to the key-value fields "Separator" and "Connector" in the node field "INPUT_STRING", with the separator "," indicating the splitting of each level of string child nodes. The value of the key field "Path" indicates the actual position of the actual printed data in the original printed data, the value of the key field "Separator" indicates the connector between multiple actual printed data, and the value of the key field "Connector" indicates the connector between the label and the value within each actual printed data.
4. The intelligent conversion method for print data format based on XFS according to claim 3, characterized in that, The key-value fields "Separator" and "Connector" are assigned values using different symbols.
5. The intelligent conversion method for print data format based on XFS according to claim 3, characterized in that, In step S21, configuring the output format of the final printed data specifically involves: The output format of the final printed data is determined according to the driver requirements of the manufacturer's printing equipment. If the driver of the printing equipment requires the output format to be JSON, then the key-value field "DataFormat" of the node field "GLOBAL" is assigned the value JSON, so that "DataFormat=JSON". If the driver of the printing device requires the output format to be XML, then assign the value JSON to the key-value field "DataFormat" of the node field "GLOBAL", making "DataFormat=XML"; If the driver of the printing device requires the output format to be a string, then assign the value STRING to the key-value field "DataFormat" of the node field "GLOBAL", making "DataFormat=STRING".
6. The intelligent conversion method for print data format based on XFS according to claim 3, characterized in that, Step S23 specifically involves: If the input format is JSON, then the values of the key-value field "Path" in the node field "INPUT_JSON" of the configuration file are read sequentially, and the actual printed data is obtained by parsing. If the input format is XML, the values of the key-value field "Path" in the node field "INPUT_XML" of the configuration file are read sequentially, and the actual printed data is obtained by parsing. If the input format is a string, the value of the key field "Path" in the node field "INPUT_STRING" of the configuration file is read sequentially to parse the actual printed data, and the symbol values of the key fields "Separator" and "Connector" in the node field "INPUT_STRING" are read.
7. The intelligent conversion method for print data format based on XFS according to claim 5, characterized in that, Step S24 specifically involves: If "DataFormat=JSON", then the actual printed data will be encapsulated and the final printed data will be output in single-layer JSON format; If "DataFormat=XML", then the actual printed data will be encapsulated and the final printed data will be output in a single-layer XML format; If "DataFormat=STRING", then the symbol values of the key fields "Separator" and "Connector" in the node field "OUTPUT_STRING" will be placed between each field and between each label and value in the actual printed data, and then encapsulated to output the final printed data in string format.
8. The intelligent conversion method for print data format based on XFS according to claim 1, characterized in that, The data conversion module is integrated into the SP interface; The configuration file is saved in INI format.
9. A smart conversion terminal for print data formats based on XFS, characterized in that, It includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, implements the XFS-based intelligent conversion method for print data formats as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Data format conversion method and device for use in network application
CN103559171A
Application authentication method and device for financial self-service equipment based on Linux system
CN105741444A