Embodiment
In order to solve the cost of development problem of higher that user in the prior art can't handle according to self needs flexible customization ticket contents and form, bill, the embodiment of the invention proposes a kind of bill processing apparatus and method.This device and method is handled required data with bill and is separated with the core print module, when carrying out the bill processing, obtains bill by special data processing module and handles required data; Bill is handled required data separate, and the format information of by special core print module bill being handled in the bill defined file of required data and customization mates with the bill defined file; During customization bill defined file, do not need to write code, and customize the bill defined file by operations such as special visual customized module pull.
Bill processing apparatus and the method for utilizing the embodiment of the invention to provide not only can make the user also reduce the cost of development that bill is handled according to self needs flexible customization ticket contents and form.
Consult shown in Figure 1ly, the bill processing apparatus that the embodiment of the invention provides comprises: data processing module 101, bill defined file module 102 and core print module 103;
Wherein, data processing module 101 is used to obtain bill and handles required data, and the required data of described bill processing are offered core print module 103;
Bill defined file module 102 is used for the bill defined file of store customized, and the bill defined file of customization is offered core print module 103;
Core print module 103, being used for bill that data processing module 101 is provided handles the format information of the bill defined file of the customization that required data and bill defined file module 102 provide and mates, call the setting of printing interface and obtain the print parameters of setting, data, the print parameters of tape format information after the coupling sent to printer 105.
Wherein, the bill that data processing module 101 is obtained is handled required data, is to be fit to the data that core print module 103 is handled.
The bill processing apparatus that the embodiment of the invention provides can also comprise visual customized module 104, is used for the user with patterned way customization bill defined file, and the bill defined file of customization is offered bill defined file module 102.
In fact, visual customized module 104 is exactly the device that a visual definition ticket contents and bill defined file are provided to the user.The user can be on the interface that visual customized module 104 provides, utilize template elements that visual customized module 104 provides optionally to customize the bill defined file by operation such as pulling voluntarily, can edit for the optional position in the self-defined paper coordinate system, as drawing.
Wherein, the bill defined file comprises the component and the format information of bill, and it has described the component and the format information of bill with the bill descriptive language.Form in the bill defined file is abundant, comprises forms such as text, form, picture, and supports the self-defined number of words reversion of text, self-defined every page of demonstration form line number.Be the selected parts part of a bill defined file below:
The direction of PrintMode 0,0//definition printer output document, the way of output during by regional output string
Org 0,100, the origin of 2100,2500//definition template and the width of template and height
* Head_begin//beginning output identification
The Font Song typeface, font, size and the style of the ensuing output character of 70,1//definition
String 520,10,1900,80,0, (// export a character string by specified coordinate, wide height, alignment thereof
String 650,10,1900,80,0, %51//export a character string by specified coordinate, wide height, alignment thereof
String 1080,10,1900,80,0) advertisement booking list // export a character string by specified coordinate, wide height, alignment thereof
Line 100,200,1950,200,4//draw straight line according to terminal coordinate, the live width of appointment
Line 100,270,1950,270,1//draw straight line according to terminal coordinate, the live width of appointment
Line 100,340,1950,340,1//draw straight line according to terminal coordinate, the live width of appointment
Line 100,410,1950,410,1//draw straight line according to terminal coordinate, the live width of appointment
The Font Song typeface, font, size and the style of the ensuing output character of 35,0//definition
String 100,130,200,50,1, contract number: // export a character string by specified coordinate, wide height, alignment thereof
String 200,130,200,50,1, %15//export a character string by specified coordinate, wide height, alignment thereof
String 650,130,200,50,1, target date: // export a character string by specified coordinate, wide height, alignment thereof
String 780,130,500,50,1, %60//export a character string by specified coordinate, wide height, alignment thereof
String 1350,130,200,50,1, the receptionist: // export a character string by specified coordinate, wide height, alignment thereof
String 1500,130,200,50,1, %16//export a character string by specified coordinate, wide height, alignment thereof
The Font Song typeface, font, size and the style of the ensuing output character of 30,0//definition
Table 100,900,3,1950,50,1,4,16//press parameter request to export form
Width 2,130,1//first column width is set
Width 6,100,1//the secondary series width is set
Width 4,150,1//the 3rd column width is set
Head_End//end output identification
Consult shown in Figure 2ly, the bill processing method that the bill processing apparatus that utilizes the embodiment of the invention to provide carries out may further comprise the steps:
S201, data processing module obtain bill and handle required data, and the required data of bill processing that obtain are offered the core print module.
Data processing module call function DoPrintData (data acquisition function), the parameter of importing to function DoPrintData is a bill type; The treatment scheme of function DoPrintData is to check whether bill type is legal, if it is legal, then go lane database to read the data of this bill type, data are deposited in obtain bill in the corresponding object and handle required data, and handle required data to the data processing module surrender of bills;
Data processing module call function ProvidePrintData (data provide function), the parameter of importing to function ProvidePrintData is that bill is handled required data; The treatment scheme of function ProvidePrintData is: this input parameter is carried out verification and buffer memory, be converted to the form that the core print module can be discerned, at last bill is handled required data and offered the core print module.
S202, core print module are accepted the data that data processing module provides, and it is carried out buffer memory.
The bill defined file of S203, the customization of bill defined file module stores, and the bill defined file that will customize offers core print module buffer memory.
Wherein, the bill defined file can be by other program customizations.
The bill that S204, core print module read its buffer memory is respectively handled the bill defined file of required data and customization.
Core print module call function DoProvideData (data read function), the parameter of importing to function DoProvideData is the required data of bill processing of core print module buffer memory; The treatment scheme of function DoProvideData is: read out the data object (bill of core print module buffer memory is handled required data) that input is come in, data in the data object are formatd, data after the format are preserved, thereby the bill that has read the data processing module buffer memory is handled required data, and has read sign in the setting of core print module.
Core print module call function GetFormatFormTPT (bill defined file function reading), the parameter of importing to function G etFormatFormTPT is the bill defined file of the customization of bill defined file module buffer memory; The treatment scheme of function G etFormatFormTPT is: whether the bill defined file of the customization of decides bill defined file module buffer memory exists, if exist, then open this document, read the data in this document, data in this document are saved in the corresponding object, thereby read the bill defined file of the customization of bill defined file module buffer memory, and read sign in the setting of core print module.
The format information that S205, core print module handle its bill that reads in the bill defined file of required data and customization mates.
The process of coupling is exactly bill to be handled each required data merge with the corresponding format information of bill defined file definition, thereby can make bill handle each required data by the call format printout in the bill defined file.
Core print module call function DoDataAndFormat (adaptation function) handles format information in the bill defined file of required data and customization to the bill that the parameter of function DoDataAndFormat input reads for the core print module; The treatment scheme of function DoDataAndFormat is: formative data object among the searching loop step S204, be each data item traversal format information, after finding the format information of data item correspondence, preserve, thereby bill is handled the data that format information in the bill defined file of required data and customization mates the tape format information after obtaining mating, and the data of the tape format information after the core print module returns coupling.
S206, core print module call the setting of printing interface, obtain the print parameters of setting.
Core print module call function ProvidePrintParam (setting of printing interface interchange function), the parameter of importing to function ProvidePrintParam is a print parameters; The treatment scheme of function ProvidePrintParam is: verification print parameters validity at first, print parameters is preserved, and travel through all print parameters then, print parameters is shown to the user, thereby has called the setting of printing interface;
Core print module call function GetPrintParam (print parameters obtains function), the treatment scheme of function G etPrintParam is: the data that read user's input, verification print parameters validity is preserved print parameters, thereby is obtained the print parameters of setting then.
The data and the print parameters of the tape format information after S207, core print module will mate send to printer by the setting of printing interface, send print command to printer.
The data of the tape format information after S208, printer will mate print output according to print parameters.
Printer call function PrintData (printf), parameter to function PrintData input is the data of the tape format information after mating and the print parameters of setting, the treatment scheme of function PrintData is: the data of at first reading in tape format information, read print parameters, according to print parameters printer is set, all data of searching loop, data are outputed to printer, print, thereby the data of the tape format information after printer will be mated print output according to print parameters.
Wherein, before step S203, can also customize the bill defined file by visual customized module, and the bill defined file of customization is offered bill defined file module; In step S202, the data that the core print module can not provide the data processing module are carried out buffer memory, in step S203, the bill defined file that the core print module can not provide bill defined file module carries out buffer memory, and in step S204, the format information in the data that the bill processing that the core print module can directly receive it is required and the bill defined file of customization mates.
Below in conjunction with a specific embodiment bill processing method that the embodiment of the invention provides is described in detail:
Embodiment one
In conjunction with Fig. 4 and Fig. 5, the embodiment of the invention one is utilized the bill processing method customization that the embodiment of the invention provides and is printed a bill with form of certain content, consults shown in Figure 3ly, and its idiographic flow is as described below:
S301, user offer bill defined file module by visual customized module customization bill defined file with the bill defined file that customizes.
Consult and Figure 4 shows that visual customized module interface sectional drawing, it is that the user passes through this visual customized module input " parameter 1 " and " parameter 2 " that this bill is handled required data; The user selects the bill component by drag operation in visual customized module, select live width, font size by drop-down menu, fills in operation such as corresponding numerical value at the input frame of wide and high correspondence and customizes the bill defined file.
S302, data processing module are prepared the data that " parameter 1 " and " parameter 2 " pairing separately suitable core print module is handled, and these data are offered the core print module.
The bill defined file of the customization that S303, the visual customized module of bill defined file module stores provide, and the bill defined file that will customize offers the core print module.
S304, core print module are accepted the bill defined file that bill that data processing module provides is handled the customization that required data and bill defined file module provide, and they are carried out buffer memory.
S305, core print module read the bill of its buffer memory respectively and play the bill defined file of handling required data and customization.
The format information that S306, core print module handle its bill that reads in the bill defined file of required data and customization mates.
Consult shown in Figure 4, first column position of first row mates in " parameter 1 " the pairing data that the core print module will read and the bill defined file of customization, and the secondary series position of first row in the bill defined file of " parameter 2 " pairing data and customization is mated.
S307, core print module call the setting of printing interface, obtain the print parameters of setting.
Consult print parameters such as shown in Figure 5, the print parameters that obtains comprises printer name, prints umber, print range.
S308, core print module be by the setting of printing interface, and the data and the print parameters of the tape format information after the coupling sent to printer, sends print command to printer.
The data of the tape format after S309, printer will mate print output according to print parameters.
The bill processing method that the embodiment of the invention one utilizes the embodiment of the invention to provide can customize and print the bill of the form with certain content that user self needs, and has reduced the cost of development that bill is handled.
In sum, bill processing apparatus that the embodiment of the invention provides and method are handled required data with bill and are separated with the core print module, when carrying out the bill processing, obtain bill by special data processing module and handle required data; Bill is handled required data separate, and the format information of bill being handled required data and bill defined file by special core print module mates with the bill defined file; The user can carry out the customization of bill defined file according to self actual needs easily by visual customized module by drag operation, and do not need to write code, and definable bill defined file form is very abundant, can comprise forms such as text, form, picture, therefore the user can reduce the cost of development that bill is handled according to self needs flexible customization ticket contents and form.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.