Print data generation device, print data generation method, data generation device for generating print data, and data generation method for generating print data

The use of templates with specified repetition ranges in print data generation simplifies the process of generating print data with variable elements, reducing code complexity and enhancing efficiency in insert printing.

WO2025142327A1PCT designated stage expired Publication Date: 2025-07-03STAR MICRONICS CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2024/042607
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-26
Filing Date
2024-12-03
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

Existing systems require complex and unintuitive program code to generate print data with variable numbers of print elements, necessitating repetitive command generation for insert printing.

Method used

Generate print data using a template and field data, where the template includes minimum unit commands without repetitions, and specify a repetition range to insert print elements, eliminating the need for repetitive code in the application.

Benefits of technology

Simplifies the generation of print data with variable elements by reducing the complexity of the program code, improving readability and efficiency in insert printing processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2024042607_03072025_PF_FP_ABST
    Figure JP2024042607_03072025_PF_FP_ABST
Patent Text Reader

Abstract

The present invention makes it possible to perform merge printing by generating print data including a variable number of print elements without incorporating, into the program code of the application for generating the print data, descriptions necessary to repeatedly generate commands. The print data is generated using both a template composed of minimum unit commands that do not include a number of repetitions corresponding to the number of print elements, which is variable, and field data including data of the print elements to be inserted into the merge field of the generation command included in the template. A repetition range RR is identified from within the template, and the merge field is replaced with the data of the print elements, including replacement of the repetitions in the identified range. Print data including printing-related commands into which print element data is inserted is then generated using a plurality of generation commands including replaced generation commands.
Need to check novelty before this filing date? Find Prior Art

Description

Print data generating device, print data generating method, data generating device for generating print data, and data generating method for generating print data

[0001] The present invention relates to a print data generating device, a print data generating method, a data generating device for generating print data, and a data generating method for generating print data, and is particularly suitable for use in a device and method for generating print data for mail merge printing, and a device and method for generating data for generating print data to generate the print data.

[0002] Conventionally, systems that send receipt print data from a POS terminal to a printer for printing include print data that includes commands for character decoration, paper cutting, and other functions in addition to print instructions (see, for example, Patent Document 1). Figure 4 of Patent Document 1 shows print data that includes multiple sets of string-printing-related commands, each of which combines a string-printing command and a string-decorating command, each of which contains a dedicated instruction code and string information. For each set of string-printing-related commands, the printer converts each character code included in the string-printing command into the corresponding font data, then applies the decoration specified by the string-decorating command and prints the data.

[0003] When generating print data containing multiple commands corresponding to print elements with a variable number of elements (for example, the item section of a receipt), as shown in Figure 4 of Patent Document 1, the application generating the print data obtains the number of elements from field data that records information about the character string to be printed, and repeatedly generates commands for that number of elements to generate the print data.

[0004] However, when generating commands multiple times, it is necessary to incorporate loops, conditional branching, and other descriptions into the program code of the application that generates the print data, which results in code that is not intuitive and difficult to understand.

[0005] Patent No. 7006096

[0006] The present invention has been made to solve such problems, and its purpose is to enable print data with a variable number of printing elements to be generated and to perform merge printing without incorporating the description necessary to repeatedly generate commands into the program code of the application that generates the print data.

[0007] To solve the above-mentioned problems, the present invention generates print data including multiple print-related commands using a template and field data including data of print elements to be inserted into the template's merge fields. The template includes one or more generation commands for generating the print-related commands, and the one or more generation commands are configured with minimum unit commands that do not include repetitions corresponding to a variable number of print elements. Then, based on the contents of both the template and the field data or the contents of the template, a range of generation commands that repeatedly executes processing a number of times corresponding to the variable number of print elements is identified from the template, and the merge fields included in the generation commands are replaced with the data of the print elements, including the replacement of repetitions within the identified range. Print data including the print-related commands into which the data of the print elements has been inserted is generated using the multiple generation commands including the replaced generation commands.

[0008] According to the present invention configured as described above, print data is generated based on a template in which one or more generation commands are configured using minimum commands that do not contain repetitions, and the generation commands are written so that the generation commands are repeatedly executed a number of times corresponding to a variable number of print elements, including generation commands in which merge fields have been replaced with print element data. This makes it possible to generate print data with a variable number of print elements and perform merge printing without incorporating the description necessary to repeatedly generate commands into the program code of the application that generates the print data.

[0009] 1 is a diagram illustrating an example of a schematic configuration of the entire printing system of the present embodiment. FIG. 1 is a diagram illustrating an example of a hardware configuration of the printing system according to the present embodiment. FIG. 2 is a block diagram illustrating an example of a functional configuration of a host device according to the present embodiment. FIG. 2 is a diagram illustrating types of printing elements included in field data and types of API call commands included in a template. FIG. 3 is a diagram for explaining an example of template replacement. FIG. 3 is a diagram for explaining the processing content of a printing API generation unit according to the first embodiment. FIG. 4 is a diagram illustrating a print result based on print data generated from the print data generation API shown in FIG. 6(b). FIG. 4 is a diagram for explaining the processing content of a printing API generation unit according to the second embodiment. FIG. 5 is a diagram illustrating a print result based on print data generated from the print data generation API shown in FIG. 8(b). FIG. 6 is a flowchart illustrating an operation example of a printing API generation unit according to the second embodiment. FIG. 7 is a flowchart illustrating an operation example of a printing API generation unit according to the second embodiment. FIG. 7 is a diagram illustrating an example of a substituted template in the generation process in the second embodiment. FIG. 8 is a diagram for explaining the processing content of a printing API generation unit according to the third embodiment. FIG. 9 is a diagram illustrating a print result based on print data generated from the print data generation API shown in FIG. 10(b). FIG. 11 is a flowchart illustrating an operation example of a printing API generation unit according to the third embodiment. 6A is a diagram showing an example of a substituted template in the generation process in the third embodiment. FIG. 8 is a diagram showing an example of the template and substituted template of FIG. 8 expressed in API call format. FIG. 8 is a diagram showing an example of the template and substituted template of FIG. 8 expressed in markup language format. FIG. 8 is a diagram showing an example of the template and substituted template of FIG. 8 expressed in printer command format. FIG. 6B is a diagram showing an example of the template of FIG. 6A expressed in API call format, markup language format, and printer command format. FIG. 6C is a diagram showing another example format of a substituted template. FIG. 6D is a diagram showing another example configuration of a printing system according to this embodiment. FIG. 6E is a diagram showing another example configuration of a printing system according to this embodiment. FIG. 6F is a diagram showing another example configuration of a printing system according to this embodiment.Fig. 1 is a diagram showing another example of the configuration of a printing system according to the present embodiment. Fig. 2 is a diagram showing another example of the configuration of a printing system according to the present embodiment. Fig. 3 is a diagram showing another example of the configuration of a printing system according to the present embodiment. Fig. 4 is a diagram for explaining an example of replacement of a template including a format specification.

[0010] An embodiment of the present invention will now be described with reference to the drawings. FIG. 1 is a diagram showing an example of the overall schematic configuration of a printing system according to this embodiment. As shown in FIG. 1, the printing system according to this embodiment is configured to include a host device 10 and a printer 20. In the configuration shown in FIG. 1, the host device 10 includes a print data generation device and a print data generation data generation device according to this embodiment. In this embodiment, a print data generation API including multiple API call commands is used as an example of print data generation data. The API call commands are an example of a "generation command" as defined in the claims.

[0011] The host device 10 and the printer 20 are connected by a wired interface cable such as a serial cable, Ethernet (registered trademark), or USB (Universal Serial Bus). Alternatively, the host device 10 and the printer 20 may be connected via a wireless communication network such as Bluetooth (registered trademark), Wi-Fi (registered trademark), or a wireless LAN. Alternatively, the host device 10 and the printer 20 may be connected via a communication network such as the Internet.

[0012] 2 is a diagram showing an example of the hardware configuration of a printing system according to this embodiment. As shown in Fig. 2, the host device 10 includes, as its hardware configuration, a control unit 101, a storage unit 102, an input unit 103, a display unit 104, and an I / F 105. The printer 20 includes, as its hardware configuration, a control unit 201, a storage unit 202, an I / F 203, and a printing unit 204.

[0013] The control unit 101 of the host device 10 is configured by a microcomputer equipped with, for example, a CPU, RAM, and ROM, and operates in accordance with an operating system and other programs stored in the storage unit 102, and executes information processing using various data stored in the storage unit 102. In addition to the microcomputer, a DSP (Digital Signal Processor) and the like may also be provided.

[0014] The storage unit 102 is configured with a computer-readable storage medium. For example, the storage unit 102 is configured to include ROM, RAM, a hard disk, or semiconductor memory. The storage unit 102 stores various programs executed by the control unit 101. The various programs include an application program that generates field data to be inserted into merge fields when performing merge printing, and a print data generation program that generates print data using the field data. Field data includes data for one or more print elements, and the number of print elements included (the number of print elements, i.e., the number of merge printing elements) is variable.

[0015] The storage unit 102 also stores various types of data, including data used in the processing of the control unit 101 and data generated during the processing. The various types of data include templates and field data used when generating print data, a print data generation API (also called a substituted template) generated by inserting field data into insertion fields included in a template, and print data in a command system generated by executing the print data generation API. Details of the templates and field data will be described later.

[0016] The input unit 103 is configured with, for example, a keyboard, a mouse, or a touch panel, and inputs data according to user operation input to the control unit 101. The display unit 104 is configured with, for example, a liquid crystal display, and displays information according to instructions input from the control unit 101. The I / F 105 is configured with a communication module that exchanges data with the printer 20, and outputs various data to the printer 20 according to instructions input from the control unit 101.

[0017] In this embodiment, under the control of the control unit 101, data to be printed, generated by an application program in the storage unit 102, is converted into print data in a command system understandable by the printer 20, and the converted print data is output from the I / F 105 to the printer 20. When performing merge printing, the control unit 101 uses a template and field data to generate print data containing multiple print-related commands. As an example, receipt print data containing a variable number of print elements, such as the name and price of the purchased item, is generated in the host device 10, and the receipt is printed by the printer 20 based on this print data.

[0018] The control unit 201 of the printer 20 is configured by a microcomputer including, for example, a CPU, RAM, and ROM, and controls the entire printer 20 according to programs stored in the storage unit 202. In addition to the microcomputer, a DSP or the like may also be provided. The storage unit 202 is configured to include ROM, RAM, or semiconductor memory, and stores various programs and data required for printing.

[0019] The I / F 203 is configured with a communication module that exchanges data with the host device 10, receives print data sent from the host device 10, and outputs it to the control unit 201. The printing unit 204, under the control of the control unit 201, executes printing in accordance with print-related commands indicated in the print data sent from the host device 10, thereby forming an image based on the print data on a recording medium such as printing paper.

[0020] 3 is a block diagram showing an example of the functional configuration of the host device 10. As shown in FIG. 3, the host device 10 of this embodiment includes a print API generation unit 11, a print data generation unit 12, a field data generation unit 13, a template storage unit 14, and a field data storage unit 15. The processes of the print API generation unit 11, the print data generation unit 12, and the field data generation unit 13 are executed by programs stored in the control unit 101 and storage unit 102 of FIG. 2. The template storage unit 14 and the field data storage unit 15 are configured by the storage unit 102 of FIG. 2.

[0021] The field data generation unit 13 generates field data including data of print elements to be inserted into merge fields of the templates stored in the template storage unit 14 through the operation of an application program stored in the storage unit 102. The field data generated by the field data generation unit 13 is stored in the field data storage unit 15.

[0022] A print element consists of a combination of an item name and an insert value (such as a character string, a numeric string, or a combination thereof) into a merge field. As shown in Figure 4(a), print elements include print elements in which one or more insert values ​​are arranged and printed on the printing paper (hereinafter referred to as array elements), and print elements in which only one insert value is arranged and printed on the printing paper (hereinafter referred to as single elements). Array elements have a variable number of elements (number of insert values). On the other hand, single elements always have a fixed, single number of elements. For example, when printing a receipt, the name and price of the purchased item are examples of array elements, while the store name and purchase date and time are examples of single elements.

[0023] The template storage unit 14 stores templates used when generating print data using field data. The templates include multiple API call commands for generating print-related commands. The print-related commands include commands that instruct printing (hereinafter referred to as print command commands) and commands that instruct decoration (hereinafter referred to as decoration command commands).

[0024] The API call command is a command that instructs the calling of an API library configured to generate print-related commands. As shown in Fig. 4B, the API call command includes a command for calling a generation library for print instruction commands (hereinafter referred to as a print instruction API call command) and a command for calling a generation library for decoration instruction commands (hereinafter referred to as a decoration instruction API call command).

[0025] There are two types of print instruction API call commands: those that include replacement rules for inserting print elements into merge fields, and those that do not. For print instruction API call commands that include replacement rules, there are cases where array element data is inserted into merge fields according to the replacement rules, and cases where single element data is inserted into merge fields. On the other hand, decoration instruction API call commands do not include replacement rules.

[0026] 5 is a diagram illustrating an example of template replacement. As shown in FIG. 5, this embodiment uses a replacement rule in which the portion starting with the symbol ${ and ending with the symbol} is treated as a merge field, and the string in the merge field is replaced with the insertion value of a print element obtained from the field data using the string enclosed in ${} as a key. FIG. 5 shows an example of replacing the merge field of a print instruction API call command with data of a single element.

[0027] The multiple API call commands included in the template are made up of a minimum command group that does not contain repetitions, the number of which corresponds to the variable number of print elements. A minimum command group that does not contain repetitions means that for a print instruction API call command that includes a replacement rule, even if multiple insert values ​​are repeatedly inserted in array elements, it does not contain API call commands for the number of array elements.

[0028] The print API generation unit 11 corresponds to the print data generation data generation unit in the claims, and based on the contents of both the template and field data or the contents of the template, identifies a range of API call commands (hereinafter sometimes abbreviated as the "repetition range") from among the multiple API call commands included in the template that repeatedly executes processing a number of times corresponding to a variable number of printing elements, and generates a print data generation API (substituted template) including the multiple API call commands by replacing merge fields included in the API call commands with data of the printing elements, including repeated replacement within the identified range. The multiple API call commands include print instruction API call commands in which merge fields have been replaced with data of the printing elements (equivalent to the substituted generation command in the claims), print instruction API call commands without merge fields, and decoration instruction API call commands.

[0029] The print data generation unit 12 executes the print data generation API generated by the print API generation unit 11 to generate print data including print-related commands into which data for print elements has been inserted. That is, the print data generation unit 12 calls an API library configured to generate print-related commands in accordance with the API call commands included in the print data generation API, and executes the processing defined by the API library to generate print data including the print-related commands. The generated print data is then output to the printer 20.

[0030] Three embodiments of the processing of the print API generation unit 11 are described below. The first embodiment specifies the repetition range of the API call command based on the contents of the template. The second and third embodiments specify the repetition range of the API call command based on the contents of both the template and field data.

[0031] First Embodiment In the first embodiment, a template has a hierarchical structure of multiple API call commands and includes a repeat start flag at one of the levels. The print API generation unit 11 identifies the range of repetition based on the repeat start flag and the hierarchical structure. The hierarchical structure is commonly used in print data generation APIs to specify the range to which character style is applied. In other words, in print data generation APIs, character style specified by a style instruction API call command at a certain level is applied to that level and any levels below it, but is not applied to any levels above it. In the first embodiment, this mechanism is used to identify the range of repetition.

[0032] FIG. 6 is a diagram for explaining the processing content of the print API generation unit 11 according to the first embodiment. In FIG. 6, decoration instruction API call commands are indicated by dotted lines, and print instruction API call commands are indicated by solid lines. Of the print instruction API call commands, those that include replacement rules are indicated by thick solid lines, and those that do not include replacement rules are indicated by thin solid lines. The execution order of the API call commands is shown from top to bottom in the diagram, with the hierarchy becoming deeper from left to right in the diagram. Note that "\n" included in the API call command indicates a line break instruction. The same applies to the following figures.

[0033] FIG. 6(a) shows an example of a hierarchically structured template and field data, with the repetition range RR specified by the print API generation unit 11 indicated by a rectangular frame within the template. The template includes a hierarchical control function, with the symbol "↓" indicating a lower level and the symbol "↑" indicating an upper level. The repetition range RR also includes a hierarchical control function. FIG. 6(b) shows an example of a print data generation API (replaced template) generated by replacing merge fields included in the API call command with print element data included in the field data, including the replacement of repetitions within the specified range. While this embodiment illustrates an example in which field data is configured in JSON format, this is not limiting. Field data can also be configured in any data format, such as XML, CSV, or Flat file.

[0034] In the example of Figure 6, the template is composed of three layers. At the beginning of the first layer, one decoration instruction API call command and one print instruction API call command are written. At the beginning of the second layer, a repeat start flag SF is written, followed by one decoration instruction API call command and one print instruction API call command. Furthermore, at the third layer, one decoration instruction API call command and one print instruction API call command are written, and then the template returns to the first layer and writes one print instruction API call command.

[0035] As shown in FIG. 6A , the print API generation unit 11 identifies the API call commands included in the second layer containing the repeat start flag SF and the third layer below as the range of API call commands for which repeat replacement is to be performed (the repeat range RR). That is, the decoration instruction API call command and the print instruction API call command included in the second layer and the decoration instruction API call command and the print instruction API call command included in the third layer are identified as the repeat range RR. The repeat range RR also includes the layer control functions associated with the identified API call commands. The layer control functions associated with the identified API call commands refer to the layer control functions (four layer control functions indicated by the symbols “↓” and “↑” in the first and second layers in the example of FIG. 6A ) that control transitions to or from the layers containing the identified API call commands (the second and third layers in the example of FIG. 6A ).

[0036] The print API generation unit 11 then generates a print data generation API (replaced template) by replacing the insertion fields of multiple print instruction API call commands included in the template with the data of the print elements (insertion values) included in the field data. At this time, as shown in FIG. 6B, the print API generation unit 11 copies the API call commands and associated hierarchical control functions included in the identified repetition range RR so that the number of copies is the same as the number of array elements included in the field data, and repeatedly executes the process of replacing the insertion fields of the print instruction API call commands with the data of the array elements a number of times corresponding to the number of array elements. The number of array elements can be determined by referencing the field data using the character string enclosed in ${} as a key.

[0037] As shown in FIG. 6( a), the field data includes one single element SE and two array elements AE. In the example of FIG. 6( a), the single element SE is the store name, and the two array elements AE are the product name and price. Each of the two array elements AE has two elements (the number of insert values). When the field data is configured in this way, the print API generation unit 11 copies a set of API call commands included in the repetition range RR, and then performs the process of replacing the print instruction API call command with the insert value of the merge field twice. The print data generation API generated as a result of this process is shown in FIG. 6( b).

[0038] 6A is replaced with the single-element SE data "Star Store" included in the field data. The single-element SE data "Star Store" used for this replacement is obtained from the field data using the character string enclosed in ${} as a key (the same applies to the following API call commands). Furthermore, the merge field "${items.name}" of the print instruction API call command at the second level included in the repetition range RR is replaced twice with the data "T-shirt" and "Denim" of the array element AE included in the field data, and the merge field "${items.price}" of the print instruction API call command at the third level is replaced twice with the data "10.99" and "29.99" of the array element AE included in the field data.

[0039] The API call command containing the array element replacement rules and the associated decoration instruction API call command must be executed repeatedly for each array element. In this embodiment, the print data generation API is generated by copying the API call command as many times as necessary. Therefore, the calling application (print data generation program) simply executes the multiple API call commands contained in the generated print data generation API one by one, starting from the top, as shown in FIG. 6B. This eliminates the need to incorporate code required to repeatedly call the API call commands into the program code of the calling application. This also applies to the second and third embodiments described below.

[0040] 7 is a diagram showing the print result when print data generated by print data generation unit 12 based on the print data generation API shown in FIG. 6B is output to printer 20. As described above, as a result of the replacement process of the print instruction API call commands for the second and third layers being repeated twice in the repetition range RR, "T-shirt" and "Denim" are printed as the product name "name" for the second layer, and "10.99" and "29.99" are printed as the price "price" for the third layer. Because the API call command for the second layer does not contain "\n", "name" for the second layer and "price" for the third layer are printed without a line break.

[0041] In the example of the print data generation API shown in Figure 6(b), the "left-justified" character style is specified at the beginning of the first layer, so the "left-justified" character style is applied to all character strings printed based on print instruction commands generated from print instruction API call commands described at the first layer and below. Also, the "bold" character style is specified at the second layer, so the "bold" character style is applied to all character strings printed based on print instruction commands generated from print instruction API call commands described at the second layer and below. Also, the "underlined" character style is specified at the third layer, so the "underlined" character style is applied to all character strings printed based on print instruction commands generated from print instruction API call commands described at the third layer.

[0042] Second Embodiment In a second embodiment, a template does not have a hierarchical structure and does not include a repetition start flag SF. The print API generation unit 11 identifies the repetition range RR based on both the type of API call command and field data included in the template.

[0043] 8 is a diagram for explaining the processing contents of the print API generation unit 11 according to the second embodiment. For ease of understanding, the API call commands included in the template are assigned indexes IDX in ascending order starting from "0". i (i=0, 1, 2, ...) is set.

[0044] Figure 8(a) shows an example of a template and field data without a hierarchical structure, with the repetition range RR specified by the print API generation unit 11 indicated by a rectangular frame in the template. Because there is no hierarchical structure specifying the range of character decoration application, the template includes an decoration instruction API call command for canceling the application of character decoration in addition to an decoration instruction API call command for instructing the application of character decoration. The field data is the same as that shown in Figure 6(a). Figure 8(b) shows an example of a print data generation API (replaced template) generated by replacing the merge field included in the API call command with the data of the printing elements included in the field data, including the replacement of repetition within the specified range.

[0045] 8A, the print API generation unit 11 identifies, as the repetition range RR, all API call commands from the print instruction API call command that includes a replacement rule using a repeating array element among the multiple print elements included in the field data to the print instruction API call command that does not include a replacement rule using an array element, as well as the decoration instruction API call command that exists before the print instruction API call command that includes a replacement rule using an array element. It is possible to determine which of the multiple API call commands included in the template is a print instruction API call command that includes a replacement rule using an array element AE by referencing the field data using the character string in the merge field of the print instruction API call command as a key.

[0046] In the template shown in FIG. 8(a), the index IDX 0 , IDX 2 The API call command of is a decoration instruction API call command that exists before the print instruction API call command that includes the replacement rule by the array element AE, so these two are included in the repetition range RR. 1is a print instruction API call command, but by referencing the field data using the string "store_name" of the merge field as a key, it is determined that the print element corresponding to the string "store_name" is not an array element AE. 1 The API call command is not included in the repetition range RR.

[0047] Index IDX 3 is a print instruction API call command, and by referencing the field data using the string "items.name" of the merge field as a key, it is determined that the print element corresponding to the string "items.name" is the array element AE. Therefore, the print API generation unit 11 determines that the print element corresponding to the string "items.name" is the array element AE. 3 is a print instruction API call command that includes a replacement rule based on the array element AE, and a search for the repetition range RR is started from this position.

[0048] Index IDX 3 Later index IDX 4 , IDX 5 , IDX 7 The API call command is a decoration instruction API call command. 6 is a print instruction API call command, but by referencing the field data using the string "items.price" of the merge field as a key, it is determined that the print element corresponding to the string "items.price" is the array element AE. Therefore, the print API generation unit 11 determines that the print element corresponding to the string "items.price" is the array element AE. 4 ~IDX 7 It is determined that the API call commands are within the repetition range RR and that none of them indicates the end position of the repetition range RR.

[0049] Index IDX 8is a print instruction API call command, and the character string "Thank you" is not enclosed in the replacement rule "${}". Therefore, the print API generation unit 11 8 is a print instruction API call command that does not include a replacement rule by the array element AE, and the index IDX immediately before it is 7 The API call command is specified as the end position of the repetition range RR.

[0050] The print API generation unit 11 then generates a print data generation API (replaced template) by replacing the merge fields of multiple print instruction API call commands included in the template with the data of the print elements (insertion values) included in the field data. At this time, as shown in Figure 8(b), the print API generation unit 11 copies the API call commands included in the specified repetition range RR so that the number of copies is the same as the number of array elements included in the field data, and repeatedly executes the process of replacing the merge fields of the print instruction API call commands with the data of the array elements a number of times corresponding to the number of array elements.

[0051] Fig. 9 is a diagram showing the print result when print data generated by the print data generation unit 12 based on the print data generation API shown in Fig. 8(b) is output to the printer 20. In the example of the print data generation API shown in Fig. 8(b), the "bold" character decoration for the product name "name" is canceled and then the "underlined" character decoration for the price "price" is set, so the product name is printed using only the bold character decoration and the price is printed using only the underlined character decoration.

[0052] 10A and 10B are flowcharts showing an example of the operation of the print API generation unit 11 according to the second embodiment. Fig. 11 is a diagram showing an example of a replaced template in the process of generation by the processing according to this flowchart. The operation will be explained below using Figs. 10A, 10B, and 11.

[0053] First, the print API generation unit 11 generates a repeat start index IDX to be used as a parameter. SThe value of is initialized to "-1" (step S1). Next, the print API generation unit 11 determines whether the next API call command exists in the template (step S2), and if not, ends the processing of the flowcharts shown in Figures 10A and 10B.

[0054] If the next API call command exists, the print API generation unit 11 obtains the next API call command from the template (step S3) and returns the current repeat start index IDX S It is determined whether the value of the repeat start index IDX is "-1" (step S4). S If the value of is "-1", the print API generation unit 11 determines whether the API call command acquired in step S3 includes a replacement rule for array elements (step S5).

[0055] If the API call command does not include a replacement rule for an array element, the print API generation unit 11 determines whether the API call command includes a replacement rule for a single element (step S6). If the API call command includes a replacement rule for a single element, the print API generation unit 11 obtains the data for the single element specified in the replacement rule from the field data and replaces the merge field of the API call command with the obtained data for the single element (step S7). Then, the API call command is added to the replaced template (step S8).

[0056] On the other hand, if it is determined in step S6 that the API call command does not include a single-element replacement rule, the process skips step S7 and adds the API call command obtained in step S3 to the replaced template as is (step S8). After step S8, the process returns to step S2, and the next API call command, if any, is obtained (step S3).

[0057] In step S3, the index IDX shown in FIG. 0 , IDX 2When the API call command is acquired, the process of step S7 is skipped and the API call command is added to the replaced template as is (step S8). 1 When the API call command is acquired, the insertion field of the API call command is replaced with the single element data specified by the replacement rule (step S7), and then the API call command is added to the replaced template (step S8). At this stage, the replaced template is configured as shown in Figure 11(a).

[0058] If it is determined in step S5 that the API call command includes a replacement rule for array elements, the repeat start index IDX S The value of the current API call command index IDX i (step S9). Then, the process returns to step S2. In step S3, the index IDX 3 When the API call command is acquired, it is determined that the API call command includes a replacement rule for array elements, so the repeat start index IDX S The value of is the index IDX 3 This index IDX is updated. 3 indicates the search start position of the repetition range RR.

[0059] Repeat start index IDX S When the value of IDX is updated, the process returns to step S2, and then in step S4, the repeat start index IDX is updated. S is not "-1". In this case, the print API generation unit 11 determines whether the API call command acquired in step S3 is a print instruction command that does not include a replacement rule for array elements (step S10). If it is determined that the print instruction command does not include a replacement rule for array elements, the process returns to step S2. In step S3, the index IDX 4 ~IDX 7At the stage when the API call command has been acquired, the determination in step S10 is No.

[0060] On the other hand, if it is determined in step S10 that the print instruction command does not include a replacement rule for array elements, the print API generation unit 11 extracts the following API call commands to be subjected to repeated replacement from the template (step S11): Repeat start index IDX from the beginning of the template S Decoration instruction API call command included up to one before Repeat start index IDX S From the current index IDX i All API call commands included up to the previous

[0061] In the example of FIG. 8(a), the index IDX 8 When the API call command is acquired, it is determined that it is a print instruction command that does not include the replacement rule for array elements. Therefore, the print API generation unit 11 performs the repeat start index IDX from the beginning of the template. 3 The previous index IDX 0 ~IDX 2 The decoration instruction API call command and the repeat start index IDX included in 3 From the current index IDX 8 The previous index IDX 3 ~IDX 7 The multiple API call commands acquired here become the repetition range RR.

[0062] Next, the print API generation unit 11 copies the multiple API call commands acquired in step S11 so that the number of copies is the same as the number of array elements included in the field data, and repeatedly executes the process of replacing the merge fields of the print instruction API call command with the data of the array elements a number of times corresponding to the number of array elements.Then, the multiple API call commands after execution are added to the replaced template (step S12).At this stage, the replaced template is configured as shown in Figure 11(b).

[0063] Next, the print API generation unit 11 uses the index IDX acquired in step S3 8 The printing API generation unit 11 determines whether the API call command includes a single element replacement rule (step S13). If the API call command includes a single element replacement rule, the printing API generation unit 11 obtains the single element data specified in the replacement rule from the field data and replaces the merge field of the API call command with the obtained single element data (step S14). Then, the API call command is added to the replaced template (step S15).

[0064] On the other hand, if the API call command does not include a single element replacement rule, the process of step S14 is skipped and the API call command acquired in step S3 is added to the replaced template as is (step S15). By executing the process of step S15, the replaced template becomes the state shown in FIG. 8(b). Thereafter, the print API generation unit 11 adds the repeat start index IDX S After resetting the value of index IDX to the initial value "-1" (step S16), the process returns to step S2. In the example of the template shown in FIG. 8(a), index IDX 8 Since there is no API call command after this, the processing of the flowcharts shown in FIGS. 10A and 10B ends.

[0065] In the third embodiment, the template has a hierarchical structure but does not include a repetition start flag SF. In the third embodiment, the repetition range RR is specified based on both the type of API call command and field data included in the template, and the hierarchical structure of the API call command.

[0066] FIG. 12 is a diagram illustrating the processing performed by the print API generation unit 11 according to the third embodiment. FIG. 12(a) shows an example of a hierarchically structured template and field data, with the repetition range RR specified by the print API generation unit 11 indicated by a rectangular frame within the template. The template includes a hierarchical control function, and in the figure, the symbol "↓" indicates a lower hierarchical level, while the symbol "↑" indicates an upper hierarchical level. The repetition range RR also includes a hierarchical control function. The field data is the same as that shown in FIG. 6(a). FIG. 12(b) shows an example of a print data generation API (replaced template) generated by replacing merge fields included in the API call command with print element data included in the field data, including the replacement of repetition within the specified range.

[0067] As shown in FIG. 12A , the print API generation unit 11 identifies, as a repetition range RR, the API call commands included in the top and lower hierarchies of the hierarchy that includes a print instruction API call command containing a replacement rule for a repeated array element among the multiple printing elements included in the field data, including the decoration instruction API call command and the print instruction API call command containing the replacement rule for the array element. The repetition range RR also includes hierarchical control functions associated with the identified API call commands. In the example of FIG. 12A , the repetition range RR includes, as related hierarchical control functions, hierarchical control functions that control transitions to or from the second and third hierarchies that include the identified API call commands (four hierarchical control functions indicated by the symbols “↓” and “↑” at the first and second hierarchies). It is possible to determine which of the multiple API call commands included in the template is a print instruction API call command containing a replacement rule for the array element AE by referencing the field data using the string in the merge field of the print instruction API call command as a key.

[0068] In the template shown in Figure 12(a), the first layer does not contain a print instruction API call command that includes a replacement rule using the array element AE, but the second and third layers contain print instruction API call commands that include a replacement rule using the array element AE. Therefore, the print API generation unit 11 identifies, among the API call commands contained in the second layer and below, decoration instruction API call commands and print instruction API call commands that include replacement rules for array elements, as well as the layer control functions associated with these, as the repetition range RR. In the example shown in Figure 12(a), since there is no print instruction API call command that includes a replacement rule using a single element SE in the second layer and below, all API call commands in the second layer and below are included in the repetition range RR.

[0069] The print API generation unit 11 then generates a print data generation API (replaced template) by replacing the insertion fields of multiple print instruction API call commands included in the template with the data of the print elements (insertion values) included in the field data. At this time, as shown in Figure 12(b), the print API generation unit 11 copies the API call commands and related hierarchical control functions included in the specified repetition range RR so that the number of copies is the same as the number of array elements included in the field data, and repeatedly executes the process of replacing the insertion fields of the print instruction API call commands with the data of the array elements a number of times corresponding to the number of array elements.

[0070] Fig. 13 is a diagram showing the print result when print data generated by the print data generation unit 12 based on the print data generation API shown in Fig. 12(b) is output to the printer 20. In the example of the print data generation API shown in Fig. 12(b), the "bold" character decoration is specified for the product name "name" at the third layer, and then the "underline" character decoration is specified for the price "price" at the second layer, so the product name is printed using only the bold character decoration and the price is printed using only the underline character decoration.

[0071] 14A and 14B are flowcharts showing an example of the operation of the print API generation unit 11 according to the third embodiment. In this flowchart, a range search flag RF indicating whether the repetition range RR is currently being searched and a top layer variable AP indicating the top layer of the repetition range RR are used as parameters. FIG. 15 is a diagram showing an example of a replaced template generated by processing according to this flowchart. The operation will be explained below using FIGS. 14A, 14B, and 15. Note that in FIG. 15, the symbols "↑" and "↓" indicating layer control functions are omitted.

[0072] First, the printing API generation unit 11 initializes the value of the range search flag RF to "No" (step S21). Next, the printing API generation unit 11 determines whether the next API call command exists in the template (step S22). If not, the processing of the flowcharts shown in Figures 14A and 14B ends.

[0073] If the next API call command exists, the print API generation unit 11 acquires the next API call command from the template (step S23) and determines whether the current value of the range search flag RF is "No" (step S24). If the value of the range search flag RF is "No", the print API generation unit 11 determines whether the API call command acquired in step S23 includes a replacement rule for array elements (step S25).

[0074] If the API call command does not include a replacement rule for an array element, the print API generation unit 11 determines whether the API call command includes a replacement rule for a single element (step S26). If the API call command includes a replacement rule for a single element, the print API generation unit 11 obtains the data for the single element specified in the replacement rule from the field data and replaces the merge field of the API call command with the obtained data for the single element (step S27). The API call command is then added to the replaced template (step S28). At this time, if there is a hierarchical control function associated with the API call command, it is also added to the replaced template.

[0075] On the other hand, if it is determined in step S26 that the API call command does not include a single-element replacement rule, step S27 is skipped and the API call command obtained in step S23 is added directly to the replaced template (step S28). At this time, if there is a hierarchical control function related to the API call command, it is also added to the replaced template. After step S28, the process returns to step S22, and the next API call command, if any, is obtained (step S23).

[0076] In step S23, the index IDX shown in FIG. 0 , IDX 2 When the API call command is acquired, the process of step S27 is skipped and the API call command is added to the replaced template as is (step S28). 2 In step S23, the hierarchical control function related to the API call command is also added to the replaced template. 1 When the API call command is acquired, the insertion field of the API call command is replaced with the single element data specified by the replacement rule (step S27), and the API call command is then added to the replaced template (step S28). At this stage, the replaced template is configured as shown in Figure 15(a).

[0077] If it is determined in step S25 that the API call command contains a replacement rule for array elements, the value of the range search flag RF is updated to "Yes" and the top layer variable AP is set to the value of the layer of the current API call command (step S29). After that, the process returns to step S22. In step S23, the index IDX 3When the API call command is acquired, it is determined that the API call command includes a replacement rule for array elements, so the value of the range search in progress flag RF is updated to "Yes", and the value of the top layer variable AP is set to "3", which indicates the third layer.

[0078] When the value of the range search in progress flag RF is updated to "Yes", it is determined in step S24 after returning to step S22 that the value of the range search in progress flag RF is not "No". In this case, the print API generation unit 11 determines whether the API call command acquired in step S23 is a print instruction command (step S30). If it is determined that it is not a print instruction command, the print API generation unit 11 adds the API call command acquired in step S23 to the replaced template as is (step S31). At this time, if there is a hierarchical control function related to the API call command, it is also added to the replaced template. Index IDX 4 At the stage up to when the API call command is acquired, the replaced template is configured as shown in FIG. 15(b). At this time, the index IDX 4 The hierarchical control function associated with the API call command is also added to the replaced template.

[0079] Then, the print API generation unit 11 determines whether the value of the current layer is smaller than the value of the top layer variable AP (step S32), and if it is smaller, updates the value of the top layer variable AP with the value of the current layer (step S33). Then, the process returns to step S22. On the other hand, if the value of the current layer is not smaller than the value of the top layer variable AP, the process of step S33 is skipped and the process returns to step S22. In step S23, the index IDX 4 When the API call command is acquired, the process of step S33 is executed and the value of the top layer variable AP is updated to the value of the current layer, "2".

[0080] If it is determined in step S30 that the API call command acquired in step S23 is a print command, the print API generation unit 11 then determines whether the print command API call command includes a replacement rule for array elements (step S34). If it is determined that the print command includes a replacement rule for array elements, the process proceeds to step S32. 5 If the API call command is acquired, the command proceeds to step S32 because it contains a replacement rule for array elements. In this case, the value of the current layer is not smaller than the value of the top layer variable AP, so the process skips step S33 and returns to step S22.

[0081] On the other hand, if it is determined in step S34 that the template does not contain replacement rules for array elements, the print API generation unit 11 extracts from the template the API call commands to be repeatedly replaced and their associated hierarchical control functions (step S35). In the third embodiment, of the API call commands included in the hierarchical levels below the top hierarchical level indicated by the top hierarchical level variable AP, the print instruction API call commands that contain the replacement rules for array elements and the associated hierarchical control functions are extracted from the template. In the example of FIG. 12(a), the index IDX 2 ~IDX 5 The API call commands and the hierarchical control functions associated with them are extracted from the template. The extracted API call commands and hierarchical control functions form the repetition range RR.

[0082] Next, the print API generation unit 11 copies the multiple API call commands and hierarchical control functions acquired in step S35 so that the number of copies is the same as the number of array elements included in the field data, and repeatedly executes the process of replacing the merge fields of the print instruction API call command with the data of the array elements a number of times corresponding to the number of array elements.Then, the multiple API call commands and hierarchical control functions after execution are added to the replaced template (step S36).At this stage, the replaced template is configured as shown in Figure 15(c).

[0083] Next, the print API generation unit 11 uses the index IDX acquired in step S23 6 The print API generation unit 11 then determines whether the API call command includes a single-element replacement rule (step S37). If the API call command includes a single-element replacement rule, the print API generation unit 11 obtains the single-element data specified in the replacement rule from the field data and replaces the merge field of the API call command with the obtained single-element data (step S38). The print API generation unit 11 then adds the API call command to the replaced template (step S39). At this time, if there is a hierarchical control function associated with the API call command, it is also added to the replaced template.

[0084] On the other hand, if the API call command does not include a replacement rule for a single element, the process of step S38 is skipped, and the API call command acquired in step S23 is added to the replaced template as is (step S39). At this time, if there is a hierarchical control function related to the API call command, it is also added to the replaced template. By executing the process of step S39, the replaced template becomes the state shown in FIG. 12(b). Thereafter, the print API generation unit 11 resets the value of the range search in progress flag RF to the initial value "No" (step S40), and then returns to step S22. In the example template shown in FIG. 12(a), the index IDX 6 Since there is no API call command after this, the processing of the flowcharts shown in FIGS. 14A and 14B ends.

[0085] As described above in detail, in this embodiment, print data including multiple print-related commands is generated using a template and field data including data of print elements to be inserted into merge fields of API call commands included in the template. The template configures multiple API call commands using a minimum command group that does not include repetitions, the number of which corresponds to a variable number of print elements. A repetition range RR is then identified from the multiple API call commands included in the template, and the merge fields included in the API call commands are replaced with data of the print elements, including the replacement of repetitions within the identified range, thereby generating a print data generation API including multiple API call commands. The generated print data generation API is then executed to generate print data including print-related commands into which data of the print elements has been inserted.

[0086] In this embodiment, the print instruction API call command and the associated decoration instruction API call command, which include the array element replacement rules, are copied as many times as necessary depending on the number of array elements, and the array element data is inserted into the merge field to generate a print data generation API. The print data is then generated by executing this print data generation API. Therefore, the calling application (print data generation program) simply executes the API call commands included in the generated print data generation API one by one, starting from the top. This allows print data with a variable number of print elements to be generated and merged without incorporating the code required to repeatedly call the API call commands into the program code of the calling application. As a result, the readability of the program code of the API calling application is improved.

[0087] In the first embodiment, the repeat start flag SF may be set in multiple locations within the template. For example, in a case where a print element with a fixed number of elements is placed after a print element with a variable number of elements, and then a print element with a variable number of elements is placed after that to perform merge printing, it is possible to set the repeat start flag SF in two locations, one for the first print element with a variable number of elements and one for the next print element with a variable number of elements.

[0088] In the second and third embodiments, examples have been described in which the repetition range RR is determined based on both the type of API call command and the field data, but the repetition range RR may also be determined without reference to the field data. For example, the type of API call command may be determined based on the character string of the API call command, and the repetition range RR may be determined based on the type of API call command. In this case, the association between which character strings correspond to which types of API call commands is defined in advance, and the template and the template-referencing program are created according to that definition.

[0089] In the third embodiment, an example was described in which, of the API call commands included in the hierarchies below the top hierarchical level indicated by the top hierarchical level variable AP, a decoration instruction API call command and a print instruction API call command including an array element replacement rule were extracted from the template to identify the repetition range RR, but a similar approach may be applied to the first embodiment. That is, of the API call commands included in the hierarchies below the hierarchical level including the repetition start flag SF, a decoration instruction API call command and a print instruction API call command including an array element replacement rule may be identified as the repetition range RR.

[0090] Furthermore, in the first to third embodiments, a configuration in which a template includes multiple API call commands has been described, but a configuration in which a template includes only one API call command is also possible. In this case, the print API generation unit 11 determines, for example, whether the API call command included in the template is an API call command for a print instruction that includes a replacement rule using a repeated array element, and if it is determined that the API call command is an API call command for a print instruction that includes a replacement rule using the array element, identifies that as the repetition range of the API call command.

[0091] Furthermore, in the first to third embodiments, an API call command is used as an example of a generation command, and an example in which a template includes one or more API call commands (hereinafter referred to as an API call format) is described. However, templates are not limited to this format. Anything with a data structure or format that allows for definition of replacement rules can be used as a template. For example, a template may be in a format in which instructions for generating print-related commands are written in a markup language (hereinafter referred to as a markup language format), or a template in which instructions for generating print-related commands are written in printer commands (hereinafter referred to as a printer command format).

[0092] Here, a markup language refers to a language that describes specifications related to the logical structure of text, decorative information, and supplemental information along with the text within text data. In the case of a markup language format, a text file in which commands for generating printing instructions and decoration instructions are marked up with predetermined symbols, etc. (the markup portion becomes metadata), is used as a template. Instructions including replacement rules are written as text in the text file. For example, commands for generating printing instructions that include replacement rules are marked up with the symbols ${}, and the instructions of the replacement rules are represented by the string enclosed in ${}. Furthermore, commands for generating decoration instructions are marked up with the symbols [ ], and the instructions are represented by the string enclosed in [ ]. Hereinafter, generation commands marked up with predetermined symbols, etc. are referred to as markup commands.

[0093] In the printer command format, each character to be printed and each character representing the replacement rule are expressed as text (e.g., ASCII characters), and binary data representing commands for generating print instructions and decoration instructions using predetermined control characters understandable by the printer 20 is used as a template. The print data (generated by the print data generator 12) sent from the host device 10 to the printer 20 is a mixture of text for the characters to be printed and control character commands. Therefore, by including replacement rules in the text portion of this print data, it is possible to create a template in printer command format. Table 1 shows an example of a printer command (control characters).

[0094]

[0095] The first to third embodiments described using the API call format can be applied to both the markup language format and the printer command format. Figures 16A to 16C are diagrams showing examples of the template and replaced template shown in Figure 8 in the second embodiment, respectively, expressed in the API call format, markup language format, and printer command format.

[0096] Fig. 16A shows the template and replaced template shown schematically in Fig. 8 rewritten in program code. In Fig. 16A(a) showing the template in this API call format, ".styleAlignment(...)", ".styleBold(...)", and ".styleUnderline(...)" are decoration instruction API call commands, and ".actionPrintText(...)" is a print instruction API call command. Fig. 16A(b) shows a replaced template (print data generation API) in the API call format generated from the template shown in Fig. 16A(a) and the same field data as Fig. 8(a).

[0097] In contrast, in Figure 16B(a), which shows a template in markup language format, the portion enclosed in ${} is a markup portion representing a command for generating print instructions, including replacement rules, and the portion enclosed in [ ] is a markup portion representing a command for generating decoration instructions. The markup language format template shown in Figure 16B(a) has the same structure as the template shown in Figure 8(a), except that the API call command has been replaced with a markup command. Therefore, the same algorithm as the flowcharts shown in Figures 10A and 10B can also be applied to the markup language format template in Figure 16B(a).

[0098] As a result, as shown in Figure 16B(a), a repetition range RR similar to that shown in Figure 8(a) is identified, and merge field replacement is performed, including the replacement of repetitions within the identified range. Here, if replacement is performed with the data of printing elements contained in the same field data as in Figure 8(a), the generated replaced template will be as shown in Figure 16B(b), which has the same structure as the replaced template shown in Figure 8(b). As a result, if print data is generated from the replaced template shown in Figure 16B(b) and sent to printer 20, and printing is performed, the print result will be the same as that shown in Figure 9.

[0099] As shown in Figure 16C(a), the printer command format template is binary data that contains a mixture of control characters for the generation command and the text of each character (ASCII characters). Categorizing this into control characters and text results in Figure 16C(b). This has the same structure as the template shown in Figure 8(a), except that the API call command has been replaced with control characters and text. Therefore, the same algorithm as the flowcharts shown in Figures 10A and 10B can also be applied to the printer command format template of Figure 16C(a).

[0100] As a result, as shown in Figure 16C(b), a repetition range RR similar to that shown in Figure 8(a) is identified, and merge field replacement is performed, including the replacement of repetitions within the identified range. Here, if replacement is performed with the data of the printing elements contained in the same field data as in Figure 8(a), the generated replaced template will be as shown in Figure 16C(c), which has the same structure as the replaced template shown in Figure 8(b). As a result, if print data is generated from the replaced template shown in Figure 16C(c) and sent to printer 20, and printing is performed, the print result will be the same as that shown in Figure 9.

[0101] Here, an example has been shown in which the template of Figure 8(a) described in the second embodiment is configured in markup language format or printer command format, but the template of Figure 6(a) described in the first embodiment and the template of Figure 12(a) described in the third embodiment can also be configured in markup language format or printer command format.

[0102] In the first and third embodiments, a hierarchical control function is included in the template, and in the first embodiment, a repeat start flag SF is also included in the template. Figure 17 is a diagram showing examples of the template of Figure 6(a), which is schematically shown in the first embodiment, expressed in API call format, markup language format, and printer command format. In Figure 17, the hierarchical levels are indented to make them easier to see. Here, the hierarchical control function and repeat start flag SF, which are not included in Figures 16A to 16C, will be described.

[0103] As shown in FIG. 17(a), in the case of the API call format, the layer control function is represented by the add function. By calling the add function, the layer of the API call command group specified in its argument becomes one layer deeper. Then, when the add function ends, the layer of the API call command group specified in its argument becomes one layer shallower (returning to the original). Here, the "↓" symbol shown in FIG. 6(a) is written as ".add(", and the "↑" symbol is written as ")". The sixth character string from the top, ".setRepeat(true)", indicates the repeat start flag SF.

[0104] As shown in Fig. 17(b), in the case of a markup language format, the character string "decorationblock:start" included in the brackets [] indicating the markup portion deepens the hierarchy by one level, and the character string "decorationblock:end" reduces the hierarchy by one level (returning to the original level). That is, the "↓" symbol shown in Fig. 6(a) is represented by the character string [decorationblock:start], and the "↑" symbol is represented by the character string [decorationblock:end]. In addition, the character string "repeat true" included in the third markup portion from the top indicates the repeat start flag SF.

[0105] As shown in Figure 17(c), in the printer command format, the layer addition command "0x1b 0x1d 0x72 0x6b 0x01" makes the layer deeper by one, and the layer end command "0x1b 0x1d 0x72 0x6b 0x00" makes the layer shallower by one (returning to the original). The layer end command causes the printer 20 to cancel the decoration set at the layer below the current layer. In addition, the command "0x1b 0x1d 0x72 0x70 0x01" indicates the repeat start flag SF.

[0106] Furthermore, in the first to third embodiments, examples have been described in which merge fields included in an API call command are replaced with printing element data, and a substituted template having the same structure as the template is used as print data generation data (print data generation API). However, the present invention is not limited to this. The substituted template may have any data structure or format that contains the printing element data replaced with field data and information sufficient for the print data generation unit 12 to convert it into a printer command. Therefore, the template before replacement and the substituted template do not necessarily have to have the same structure.

[0107] For example, a substituted template generated by replacing merge fields with print element data may be used to generate print data generation data that includes a structure representing the type of instruction, the type of instruction, and the print element data from the print-related command. As an example, as shown in FIG. 18A, a substituted template may be configured using a data structure similar to that of the C++ programming language, which includes a type member for classifying print instructions and decoration instructions, a name member that is a string indicating the type of instruction, and an info member that is a dictionary that stores information required for the instruction. The substituted template configured with this data structure may then be converted into print data that includes print-related commands. This is applicable to any of the first to third embodiments described above.

[0108] When a replaced template having the data structure shown in Fig. 18(a) is used, for example, information equivalent to the print instruction API call command "actionPrintText" of the replaced template shown in Fig. 5 can be stored as values ​​as shown in Fig. 18(b) for the data structure of Fig. 18(a). Also, information equivalent to the decoration instruction API call command "styleAlignment" of the replaced template shown in Fig. 5 can be stored as values ​​as shown in Fig. 18(c) for the data structure of Fig. 18(a).

[0109] Here, an example has been described in which a substituted template in C++ format is generated from a template in API call format. However, a substituted template in C++ format can also be generated from a template in markup language format or printer command format. The C++ format is an example of a format different from the template before substitution, and is not limited to this format. For example, a substituted template in markup language format or printer command format can be generated from a template in API call format, or a substituted template in API call format or printer command format can be generated from the markup language format, or a substituted template in API call format or markup language format can be generated from the printer command format.

[0110] Furthermore, in the first to third embodiments, an example was described in which a replaced template was generated by replacing merge fields included in an API call command with print element data, and then print data generation data (print data generation API) was generated from the replaced template. However, the present invention is not limited to this. For example, by replacing merge fields with print element data, including repeated replacement within a specified range, multiple API call commands including the replaced API call command may be sequentially generated, and print-related commands (printer commands) may be sequentially generated from the API call command each time a new API call command is generated, thereby generating print data.

[0111] For example, in the first embodiment, when generating print data from the template and field data shown in FIG. 6A, the process may be executed in the following order: (0) First, set the setting values ​​of the decoration information to their initial values. For example, set the alignment setting to "Left," the bold setting to "false," and the underline setting to "false." (1) Execute the decoration instruction API call command "Alignment Left" to generate a left-justified printer command, and set the setting value of the first layer alignment setting to "Left" (no change from the initial value). (2) Execute the print instruction API call command "Text "${store_name}\n"" that includes a single element replacement rule to generate a printer command for printing the print element "Star Store\n."

[0112] Next, in steps (3) to (8), the first processing is performed for the repetition range specified by the repetition start flag SF. (3) A printer command with bold enabled is generated by executing the decoration instruction API call command "Bold," and the setting value for the bold specification at the second level is set to "true." (4) A printer command for printing the print element "T-shirt" is generated by executing the print instruction API call command "Text "${items.name}"," which includes a replacement rule for the repeat array element. (5) A printer command with underlining enabled is generated by executing the decoration instruction API call command "Underline," and the setting value for the underlining specification at the third level is set to "true." (6) A printer command for printing the print element "10.99\n" is generated by executing the print instruction API call command "Text "${items.price}\n," which includes a replacement rule for the repeat array element. (7) When exiting the third layer, the underline setting value "true" for the third layer differs from the underline setting value "false" for the second layer, so a printer command is generated that disables underlining and sets the underline setting value to that of the second layer. (8) When exiting the second layer, the bold setting value "true" for the second layer differs from the bold setting value "false" for the first layer, so a printer command is generated that disables bold and sets the bold setting value to that of the first layer.

[0113] Next, in steps (9) to (14), a second processing is performed for the repetition range specified by the repetition start flag SF. (9) A printer command with bold enabled is generated by executing the decoration instruction API call command "Bold," and the setting value for the bold specification at the second level is set to "true." (10) A printer command for printing the print element "Denim" is generated by executing the print instruction API call command "Text "${items.name}"," which includes a replacement rule for the repeat array element. (11) A printer command with underlining enabled is generated by executing the decoration instruction API call command "Underline," and the setting value for the underlining specification at the third level is set to "true." (12) A printer command for printing the print element "29.99\n" is generated by executing the print instruction API call command "Text "${items.price}\n," which includes a replacement rule for the repeat array element. (13) When exiting the third layer, the underline setting value "true" for the third layer differs from the underline setting value "false" for the second layer, so a printer command is generated that disables underlining and sets the underline setting value to that of the second layer. (14) When exiting the second layer, the bold setting value "true" for the second layer differs from the bold setting value "false" for the first layer, so a printer command is generated that disables bold and sets the bold setting value to that of the first layer.

[0114] (15) Finally, a printer command for printing "Thank you\n" is generated by executing the print instruction API call command "Text "Thank you\n"" which does not include a replacement rule.

[0115] Although an example has been shown here in which printer commands are generated sequentially from the template of Fig. 6(a) described in the first embodiment, it is also possible to generate printer commands sequentially from the template of Fig. 8(a) described in the second embodiment and the template of Fig. 12(a) described in the third embodiment in the same way. Also, although an example has been shown in which printer commands are generated sequentially from templates in an API call format, it is similarly possible to generate printer commands sequentially from templates in a markup language format or a printer command format.

[0116] In the first to third embodiments, as shown in Figures 1 and 3, the host device 10 includes a print API generation unit 11, a print data generation unit 12, a template storage unit 14, and a field data storage unit 15, and the host device 10 generates a print data generation API (print data generation data) and print data, and transmits the generated print data from the host device 10 to the printer 20 to execute printing. However, the present invention is not limited to this system configuration. For example, the system configurations shown in Figures 19A to 19H may also be used.

[0117] 19A, the host device 10 includes a field data storage unit 15, while the printer 20 includes a print API generation unit 11, a print data generation unit 12, and a template storage unit 14. The printer 20 then combines the template it holds with the field data sent from the host device 10 to execute the processing of the print API generation unit 11 and the print data generation unit 12, and performs printing based on the generated print data.

[0118] 19B, the host device 10 includes a field data storage unit 15, the server (for example, a server on a cloud or a server on a LAN; the same applies below) includes a template storage unit 14, and the printer 20 includes a print API generation unit 11 and a print data generation unit 12. The printer 20 then combines the template sent from the server with the field data sent from the host device 10 to execute the processing of the print API generation unit 11 and the print data generation unit 12, and performs printing based on the generated print data.

[0119] 19C, the host device 10 includes a template storage unit 14, the server includes a field data storage unit 15, and the printer 20 includes a print API generation unit 11 and a print data generation unit 12. The printer 20 then combines the field data sent from the server with the template sent from the host device 10 to execute the processing of the print API generation unit 11 and the print data generation unit 12, and performs printing based on the generated print data.

[0120] 19D, the printer 20 has a print API generation unit 11 and a print data generation unit 12, while the server has a template storage unit 14 and a field data storage unit 15, and the host device 10 only issues a command to execute merge printing to the printer 20. Upon receiving this print execution command, the printer 20 acquires the specified template and field data from the server, combines them, executes the processing of the print API generation unit 11 and the print data generation unit 12, and executes printing based on the generated print data.

[0121] 19E, the printer 20 includes a print API generation unit 11, a print data generation unit 12, and a template storage unit 14, while the server includes a field data storage unit 15, and the host device 10 only issues a command to execute merge printing to the printer 20. Upon receiving this print execution command, the printer 20 combines the template it holds with the field data acquired from the server, executes the processing of the print API generation unit 11 and the print data generation unit 12, and executes printing based on the generated print data.

[0122] The system configuration shown in Figure 19F is a variation of the system configuration shown in Figure 19D, in which the host device 10 issues a command to the printer 20 to execute merge printing via a cloud server. In addition to the host device 10 and printer 20, the system configuration shown in Figure 19F also includes a POS service cloud server and a print job management cloud server. The print job management cloud server includes a template storage unit 14 and a field data storage unit 15. The host device 10 issues a command to the printer 20 to execute merge printing via the POS service cloud server and the print job management cloud server. Upon receiving this print execution command, the printer 20 acquires the template and field data specified by the print job management cloud server, combines them, executes the processing of the print API generation unit 11 and the print data generation unit 12, and executes printing based on the generated print data. Note that a similar configuration can also be applied as a variation of the system configuration shown in Figure 19E.

[0123] The system configuration shown in FIG. 19G includes a host device 10, a printer 20, a print job management cloud server, and a print job receiving terminal. The print job receiving terminal includes a print API generation unit 11 and a print data generation unit 12, while the print job management cloud server includes a template storage unit 14 and a field data storage unit 15. The host device 10 and the print job receiving terminal are connected via, for example, a wired / wireless LAN, Bluetooth (registered trademark), or Wi-Fi (registered trademark). The printer 20 and the print job receiving terminal are connected via, for example, a serial cable, USB, Bluetooth (registered trademark), etc. Unlike in FIGS. 19B to 19F, the printer 20 does not need to be connected to the Internet, etc. The host device 10 only issues a command to the print job receiving terminal to execute merge printing. Upon receiving this print execution command, the print job receiving terminal obtains the template and field data specified by the print job management cloud server, combines them to execute the processing of the print API generation unit 11 and the print data generation unit 12, and sends the generated print data to the printer 20 to execute printing.

[0124] In the system configuration shown in FIG. 19H , a cloud server includes a template editor, allowing the host device 10 to access the cloud server and create a template. In the system configuration shown in FIG. 19H , a template is created on the host device 10 using the cloud server's template editor ( FIG. 19H( a) ), and the created template is uploaded from the host device 10 to the cloud server ( FIG. 19H( b) ). In the system configuration shown in FIG. 19H , the host device 10 includes a field data storage unit 15, and the cloud server includes a print API generation unit 11, a print data generation unit 12, and a template storage unit 14. The template storage unit 14 stores the template uploaded from the host device 10. As shown in FIG. 19H( c), the host device 10 uploads field data to the cloud server and issues a command to execute merge printing. Upon receiving this print execution command, the cloud server combines the template stored therein with the field data acquired from the host device 10, executes the processing of the print API generation unit 11 and the print data generation unit 12, and sends the generated print data to the printer 20 for printing.

[0125] 1 and 19A to 19H show a configuration in which both the print API generation unit 11 and the print data generation unit 12 are provided in a single device (either the host device 10, the printer 20, the server, or the print job receiving terminal), but the print API generation unit 11 and the print data generation unit 12 may be provided separately in separate devices. For example, as a variation of the system configuration of FIG. 1, the host device 10 may include the print API generation unit 11, while the printer 20 may include the print data generation unit 12, and the print data generation API (substituted template) generated by the host device 10 may be sent to the printer 20, and the printer 20 may generate print data by executing the print data generation API. This can also be applied to the system configurations shown in FIGS. 19A to 19H.

[0126] 19A to 19H, it is also possible to use a markup language format or printer command format template instead of the API call format template. Also, it is also possible to use a C++ format substituted template instead of the API call format substituted template.

[0127] Furthermore, in the first to third embodiments, the format of the string after replacement may be specified by the replacement rule of the API call command included in the template. For example, a merge field for a replacement rule starting with the symbol ${ and ending with the symbol} may be configured as follows (the " " and + symbols are for explanation purposes only and are not actually shown), allowing the expression or layout of the string when field data is inserted into the merge field to be specified according to the content of the format specifier: "${" + "key" + "format specifier" + "}"

[0128] The following can be used as format specifiers, for example: (A) Format specifiers for numeric field data When the field data is a numeric value, the string into which it will be replaced can be specified using format specifiers used in functions such as the printf function in C. Some specific examples are as follows: %d: Converts to a string as a signed decimal integer. %f: Converts to a string as a decimal number. %1d: Converts to a string as a one-digit signed decimal integer. %5.2f: Converts to a string as a decimal number with five digits in total including the decimal point and two digits after the decimal point.

[0129] (B) Format specifier for specifying the number of characters The number of characters after replacement and whether or not to omit can be specified using a format specifier. Some specific examples are as follows: %digit=4,last: The number of characters after replacement is 4. The end of the field data is trimmed. %digit=10,last,ellipsis: The number of characters after replacement is 10. The end of the field data is trimmed and an ellipsis (...) is added. %digit=10,middle,ellipsis: The number of characters after replacement is 10. The middle of the field data is trimmed and an ellipsis (...) is added. %digit=10,first,ellipsis: The number of characters after replacement is 10. The start of the field data is trimmed and an ellipsis (...) is added.

[0130] In this way, for example, if the field data is a number, it is possible to control what character string will be printed when it is inserted into a template merge field. For example, if the field data contains the value pi, 3.14159265359, it is possible to specify in the template whether the value should be printed as "3," "3.14," or "3.14159265359." Furthermore, if the printing paper is narrow and there is a limit to the number of characters that can fit on one line, specifying the template can prevent unintended line breaks that occur when the field data string is too long to fit on one line and the characters wrap around to the next line.

[0131] A specific example will be described below. Here, an example will be described in which the printing paper is a receipt and a character string including an item list is printed. The maximum number of characters that can be printed per line on a receipt is 32, and it is desired that the number of characters per line of print data be kept to 32 characters or less. In this case, a template with a specified format, such as that shown in Figure 20(a), is prepared.

[0132] In the template shown in Figure 20(a), the "${items.name%digit=23,last,ellipsis}" section specifies that the product name should be 23 characters long, and if it does not fit, the end should be truncated and "..." should be added. Up to this point, 23 / 32 characters will be printed per line. The next "x" section is a fixed string that is placed before the quantity replacement rule. Up to this point, 25 / 32 characters will be printed per line. The next "${items.quantity%1d}" section specifies that the quantity value should be converted into a one-character decimal integer. Up to this point, 26 / 32 characters will be printed per line. The next " " section is a fixed string that is placed before the unit price replacement rule. Up to this point, 27 / 32 characters will be printed per line. The next part, "${items.price%5.2f}\n", specifies that the unit price should be converted to a string of five characters including the decimal point, with two decimal places. Up to this point, 32 characters x 32 characters will be printed on one line. The final "\n" will cause a line break.

[0133] When the template in Figure 20(a) is used in combination with the field data in Figure 20(b), the print result shown in Figure 20(c) is obtained. In this way, by specifying the number of characters in the template's replacement rules, you can flexibly specify the layout of text within a line. In addition, the numerical values ​​in the field data can be converted into text that conforms to the receipt layout.

[0134] Furthermore, the above-described embodiments are merely examples of specific embodiments for carrying out the present invention, and the technical scope of the present invention should not be construed as being limited thereby. In other words, the present invention can be carried out in various forms without departing from the gist or main characteristics thereof.

[0135] 10 Host device 11 Printing API generation unit (print data generation data generation unit) 12 Print data generation unit 13 Field data generation unit 14 Template storage unit 15 Field data storage unit 20 Printer

Claims

1. A print data generation device that generates print data including a plurality of print-related commands using a template and field data including data of print elements to be inserted into the insertion fields of the template, wherein the template includes one or more generation commands for generating the print-related commands, the one or more generation commands are composed of commands in a minimum unit that do not include repetitions according to the variable number of print elements, and based on the contents of both the template and the field data or the contents of the template, a range of the generation commands to be repeatedly executed a number of times according to the variable number of print elements is specified from the template, and including replacement by repetition within the specified range, the insertion fields included in the generation commands are replaced with the data of the print elements, and the print data including the print-related commands into which the data of the print elements are inserted is generated using a plurality of generation commands including the replaced generation commands. A print data generation device characterized by the above.

2. A print data generation data generation unit that generates print data generation data having a structure in the same format as the template and including the plurality of generation commands by replacing the insertion fields included in the generation commands with the data of the print elements including replacement by repetition within the specified range, and a print data generation unit that generates the print data using the print data generation data generated by the print data generation data generation unit. The print data generation device according to claim 1, characterized by the above.

3. A print data generation data generation unit that generates print data generation data having a structure in a different format from the template and including the plurality of generation commands by replacing the insertion fields included in the generation commands with the data of the print elements including replacement by repetition within the specified range, and a print data generation unit that generates the print data using the print data generation data generated by the print data generation data generation unit. The print data generation device according to claim 1, characterized by the above.

4. By replacing the interpolation fields included in the generation command with the data of the printing elements, including repeated replacement within the specified range, a plurality of generation commands including the replaced generation command are sequentially generated. Each time one of the plurality of generation commands is generated, the printing data is generated by sequentially generating the printing-related commands from the generation command. The printing data generation device according to claim 1, characterized in that.

5. The template is a template in a format including an API call command for calling and executing an API in which a process for generating the printing-related command is described as the generation command. The printing data generation device according to any one of claims 1 to 4, characterized in that.

6. The template is a template in a format in which an instruction for generating the printing-related command is described in a markup language as the generation command. The printing data generation device according to any one of claims 1 to 4, characterized in that.

7. The template is a template in a format in which an instruction for generating the printing-related command is described in a printer command as the generation command. The printing data generation device according to any one of claims 1 to 4, characterized in that.

8. A printing data generation method for generating printing data including a plurality of printing-related commands using a template and field data including data of printing elements to be inserted into insertion fields of the template, wherein the template includes one or more generation commands for generating the printing-related commands, the one or more generation commands are composed of commands in a minimum unit that do not include repetitions according to a variable number of printing elements, a control unit of a printing data generation apparatus specifies a range of generation commands that repeatedly execute processing a number of times according to the variable number of printing elements from among the template based on both the contents of the template and the field data or the contents of the template, replaces the insertion fields included in the generation commands with the data of the printing elements including replacement of repetitions in the specified range, and generates the printing data including the printing-related commands into which the data of the printing elements are inserted using a plurality of generation commands including the replaced generation commands.

9. A printing data generation data generation apparatus for generating printing data generation data including a plurality of generation commands using a template and field data including data of printing elements to be inserted into insertion fields of the template, wherein the template includes one or more generation commands for generating printing-related commands included in the printing data, the one or more generation commands are composed of commands in a minimum unit that do not include repetitions according to a variable number of printing elements, based on both the contents of the template and the field data or the contents of the template, a range of generation commands that repeatedly execute processing a number of times according to the variable number of printing elements is specified from among the template, and the printing data generation data generation unit for generating printing data generation data including a plurality of generation commands is provided by replacing the insertion fields included in the generation commands with the data of the printing elements including replacement of repetitions in the specified range.

10. A method for generating data for generating print data, which uses a template and field data including data of print elements to be inserted into insertion fields of the template, to generate data for generating print data including a plurality of generation commands, wherein the template includes one or more generation commands for generating print-related commands included in the print data, the one or more generation commands are composed of commands in a minimum unit that do not include repetitions according to the variable number of print elements, and a print data generation unit of a print data generation apparatus for generating data for generating print data specifies a range of generation commands that repeatedly execute processing a number of times according to the variable number of print elements from among the templates, and by replacing the insertion fields included in the generation commands with the data of the print elements including replacement of repetitions in the specified range, generates data for generating print data including a plurality of generation commands.

Citation Information

Patent Citations

  • Information processing device and control method for information processing device

    JP7006096B2

  • Information processor, information processing method and program

    JP2008269261A

  • Information processing device, information processing system and program

    JP2017033368A