System, method and medium suitable for file conversion of credit self-service terminal

文档序号:1963674 发布日期:2021-12-14 浏览:19次 中文

阅读说明:本技术 一种适用于信创自助终端文件转换的系统、方法及介质 (System, method and medium suitable for file conversion of credit self-service terminal ) 是由 张涛 王思栋 胡焱 牛鹏 于 2021-09-24 设计创作,主要内容包括:本发明公开了一种适用于信创自助终端文件转换的系统、方法及介质,所述系统包括:文件获取模块、配置管理模块、参数解析模块、文件解析模块和文件转换模块;文件获取模块用于获取原始文件和第一参数:配置管理模块用于获取配置参数,得到第二参数;参数解析模块用于对第一参数和第二参数执行参数解析操作,得到解析参数;文件解析模块用于对原始文件执行文件解析操作,得到文件数据信息;文件转换模块用于根据文件数据信息和解析参数执行文件转换操作,得到目标文件;通过上述方式,本发明可以实现对多种格式的原始文件进行自动文件转换,并且支持通用格式和定制化格式的转换,提升文件转换的效率,提高文件转换的通用性和复用性。(The invention discloses a system, a method and a medium suitable for file conversion of a credit self-service terminal, wherein the system comprises: the system comprises a file acquisition module, a configuration management module, a parameter analysis module, a file analysis module and a file conversion module; the file acquisition module is used for acquiring an original file and a first parameter: the configuration management module is used for acquiring configuration parameters to obtain second parameters; the parameter analysis module is used for executing parameter analysis operation on the first parameter and the second parameter to obtain analysis parameters; the file analysis module is used for executing file analysis operation on the original file to obtain file data information; the file conversion module is used for executing file conversion operation according to the file data information and the analysis parameters to obtain a target file; by the mode, the automatic file conversion method and the automatic file conversion device can realize automatic file conversion on the original files in various formats, support the conversion between the universal format and the customized format, improve the efficiency of file conversion, and improve the universality and reusability of file conversion.)

1. A system suitable for file conversion of a credit self-service terminal is characterized by comprising: the system comprises a file acquisition module, a configuration management module, a parameter analysis module, a file analysis module and a file conversion module;

the file acquisition module is used for acquiring an original file and a first parameter;

the configuration management module is used for acquiring configuration parameters and obtaining second parameters through the configuration parameters;

the parameter analysis module is used for executing parameter analysis operation on the first parameter and the second parameter to obtain analysis parameters;

the file analysis module is used for executing file analysis operation on the original file to obtain file data information;

and the file conversion module is used for executing file conversion operation according to the file data information and the analysis parameters to obtain a target file.

2. The system for file conversion of a credit self-service terminal according to claim 1, wherein:

the original files comprise a first type of file, a second type of file, a third type of file and a fourth type of file; the file data information comprises first data information, second data information, third data information and fourth data information; the file analysis module comprises a text file analysis unit, a picture file analysis unit, a webpage file analysis unit and a PDF file analysis unit;

the text file analysis unit is used for executing text file analysis operation on the first type of file to obtain the first data information;

the picture file analysis unit is used for executing picture file analysis operation on the second class file to obtain the second data information;

the webpage file analyzing unit is used for executing webpage file analyzing operation on the third type of files to obtain third data information;

the PDF file analysis unit is used for executing portable file analysis operation on the fourth type of file to obtain the fourth data information.

3. The system for file conversion of the credit self-service terminal according to claim 2, wherein:

the file conversion module comprises a text file conversion unit, a webpage file conversion unit, an image file conversion unit and a PDF file conversion unit;

the text file conversion unit is used for executing text file conversion operation according to the first data information and the analysis parameter to obtain the target file;

the picture file conversion unit is used for executing picture file conversion operation according to the second data information and the analysis parameter to obtain the target file;

the webpage file conversion unit is used for executing webpage file conversion operation according to the third data information and the analysis parameter to obtain the target file;

the PDF file conversion unit is used for executing portable file conversion operation according to the fourth data information and the analysis parameter to obtain the target file.

4. The system for file conversion of a credit self-service terminal according to claim 3, wherein:

and when the file size of the original file is different from the file size of the target file, the PDF file conversion unit calls a file size conversion strategy to execute file size conversion operation.

5. The system for file conversion of a credit self-service terminal according to claim 4, wherein:

the PDF file conversion unit sets a safe clipping value through the file size conversion strategy;

the PDF file conversion unit sets a cutting threshold value according to the safe cutting value;

the PDF file conversion unit executes the calculation operation of the cutting area according to the cutting threshold and the fine coordinate of the original file to obtain the coordinate of the cutting area;

the PDF file conversion unit executes file cutting operation on the original file according to the cutting area coordinates to obtain a cut file;

the PDF file conversion unit acquires target file size information, a picture scaling and stretching ratio and a first slant distance and a first offset angle between the cut file and the target file of the target file, and executes target coordinate calculation operation according to the target file size information, the picture scaling and stretching ratio, the first slant distance, the first offset angle and the cut area coordinate to obtain a target coordinate;

and the PDF file conversion unit executes a file clipping attachment operation according to the target coordinate to obtain the target file.

6. The system for file conversion of a credit self-service terminal according to claim 3, wherein:

the text file conversion unit is provided with a first text file conversion mode and a second text file conversion mode;

when the value of the conversion mode of the analysis parameter is a first text conversion mode, the text file conversion unit calls the first text file conversion mode to execute the text file conversion operation to obtain the target file;

and when the value of the conversion mode of the analysis parameter is a second text conversion mode, the text file conversion unit calls the second text file conversion mode to execute the text file conversion operation to obtain the target file.

7. The system for file conversion of a credit self-service terminal according to claim 3, wherein:

the webpage file conversion unit is provided with a first webpage file conversion mode and a second webpage file conversion mode;

when the value of the conversion mode of the analysis parameter is a first webpage conversion mode, the webpage file conversion unit calls the first webpage file conversion mode to execute the webpage file conversion operation to obtain the target file;

and when the value of the conversion mode of the analysis parameter is a second webpage conversion mode, the webpage file conversion unit calls the second webpage file conversion mode to execute the webpage file conversion operation to obtain the target file.

8. The system for file conversion of a credit self-service terminal according to claim 3, wherein:

the PDF file conversion unit is provided with a first PDF file conversion mode, a second PDF file conversion mode and a third PDF file conversion mode;

when the value of the conversion mode of the analysis parameter is a first PDF conversion mode, the PDF file conversion unit calls the first PDF file conversion mode to execute the portable file conversion operation to obtain the target file;

when the value of the conversion mode of the analysis parameter is a second PDF conversion mode, the PDF file conversion unit calls the second PDF file conversion mode to execute the portable file conversion operation to obtain the target file;

and when the value of the conversion mode of the analysis parameter is a third PDF conversion mode, the PDF file conversion unit calls the third PDF file conversion mode to execute the portable file conversion operation to obtain the target file.

9. A method suitable for file conversion of a credit self-service terminal is characterized by comprising the following steps:

acquiring a file: acquiring an original file, a first parameter and a configuration parameter;

configuring parameters: performing parameter analysis operation on the first parameter and the configuration parameter to obtain an analysis parameter;

analyzing the file: performing file analysis operation on the original file to obtain file data information;

converting the file: and executing file conversion operation according to the file data information and the analysis parameters to obtain a target file.

10. A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, performs the method steps of claim 9, adapted for trusted self-service terminal file conversion.

Technical Field

The invention relates to the technical field of file conversion, in particular to a system, a method and a medium suitable for file conversion of a credit self-service terminal.

Background

The credit creation self-service terminal mainly refers to terminal equipment using a domestic CPU and an operating system, and is gradually applied to the industries of finance, insurance, securities and the like at present. In the credit self-service terminal, the printing service is a common service.

Aiming at the printing service of the credit self-service terminal in the centering application scene, a set of flexible printing file conversion scheme for clothing is required. The existing printing file conversion scheme has poor automation degree and low conversion efficiency, the convertible file format is single, various application scenes are difficult to meet, and certain limitation is caused in operation; in addition, certain universality is lacked, the reusability is poor, and the service requirements cannot be rapidly adapted.

Disclosure of Invention

The invention mainly solves the problems that the existing file conversion method has poor automation degree, low conversion efficiency, poor universality and poor reusability, and is difficult to meet various application scenes.

In order to solve the above problems, the present invention adopts a technical solution that: the system suitable for file conversion of the credit self-service terminal comprises the following components: the system comprises a file acquisition module, a configuration management module, a parameter analysis module, a file analysis module and a file conversion module;

the file acquisition module is used for acquiring an original file and a first parameter;

the configuration management module is used for acquiring configuration parameters and obtaining second parameters through the configuration parameters;

the parameter analysis module is used for executing parameter analysis operation on the first parameter and the second parameter to obtain analysis parameters;

the file analysis module is used for executing file analysis operation on the original file to obtain file data information;

and the file conversion module is used for executing file conversion operation according to the file data information and the analysis parameters to obtain a target file.

Further, the original files comprise a first type of file, a second type of file, a third type of file and a fourth type of file; the file data information comprises first data information, second data information, third data information and fourth data information; the file analysis module comprises a text file analysis unit, a picture file analysis unit, a webpage file analysis unit and a PDF file analysis unit;

the text file analysis unit is used for executing text file analysis operation on the first type of file to obtain the first data information;

the picture file analysis unit is used for executing picture file analysis operation on the second class file to obtain the second data information;

the webpage file analyzing unit is used for executing webpage file analyzing operation on the third type of files to obtain third data information;

the PDF file analysis unit is used for executing portable file analysis operation on the fourth type of file to obtain the fourth data information.

Further, the file conversion module comprises a text file conversion unit, a webpage file conversion unit, an image file conversion unit and a PDF file conversion unit;

the text file conversion unit is used for executing text file conversion operation according to the first data information and the analysis parameter to obtain the target file;

the picture file conversion unit is used for executing picture file conversion operation according to the second data information and the analysis parameter to obtain the target file;

the webpage file conversion unit is used for executing webpage file conversion operation according to the third data information and the analysis parameter to obtain the target file;

the PDF file conversion unit is used for executing portable file conversion operation according to the fourth data information and the analysis parameter to obtain the target file.

Further, when the file size of the original file is not the same as the file size of the target file, the PDF file converting unit invokes a file size conversion policy to perform a file size conversion operation.

Further, the PDF file conversion unit sets a safe clipping value according to the file size conversion strategy;

the PDF file conversion unit sets a cutting threshold value according to the safe cutting value;

the PDF file conversion unit executes the calculation operation of the cutting area according to the cutting threshold and the fine coordinate of the original file to obtain the coordinate of the cutting area;

the PDF file conversion unit executes file cutting operation on the original file according to the cutting area coordinates to obtain a cut file;

the PDF file conversion unit acquires target file size information, a picture scaling and stretching ratio and a first slant distance and a first offset angle between the cut file and the target file of the target file, and executes target coordinate calculation operation according to the target file size information, the picture scaling and stretching ratio, the first slant distance, the first offset angle and the cut area coordinate to obtain a target coordinate;

and the PDF file conversion unit executes a file clipping attachment operation according to the target coordinate to obtain the target file.

Further, a first text file conversion mode and a second text file conversion mode are arranged in the text file conversion unit;

when the value of the conversion mode of the analysis parameter is a first text conversion mode, the text file conversion unit calls the first text file conversion mode to execute the text file conversion operation to obtain the target file;

and when the value of the conversion mode of the analysis parameter is a second text conversion mode, the text file conversion unit calls the second text file conversion mode to execute the text file conversion operation to obtain the target file.

Furthermore, a first webpage file conversion mode and a second webpage file conversion mode are arranged in the webpage file conversion unit;

when the value of the conversion mode of the analysis parameter is a first webpage conversion mode, the webpage file conversion unit calls the first webpage file conversion mode to execute the webpage file conversion operation to obtain the target file;

and when the value of the conversion mode of the analysis parameter is a second webpage conversion mode, the webpage file conversion unit calls the second webpage file conversion mode to execute the webpage file conversion operation to obtain the target file.

Further, a first PDF file conversion mode, a second PDF file conversion mode and a third PDF file conversion mode are set in the PDF file conversion unit;

when the value of the conversion mode of the analysis parameter is a first PDF conversion mode, the PDF file conversion unit calls the first PDF file conversion mode to execute the portable file conversion operation to obtain the target file;

when the value of the conversion mode of the analysis parameter is a second PDF conversion mode, the PDF file conversion unit calls the second PDF file conversion mode to execute the portable file conversion operation to obtain the target file;

and when the value of the conversion mode of the analysis parameter is a third PDF conversion mode, the PDF file conversion unit calls the third PDF file conversion mode to execute the portable file conversion operation to obtain the target file.

A method suitable for file conversion of a credit self-service terminal comprises the following steps:

acquiring a file: acquiring an original file, a first parameter and a configuration parameter;

configuring parameters: performing parameter analysis operation on the first parameter and the configuration parameter to obtain an analysis parameter;

analyzing the file: performing file analysis operation on the original file to obtain file data information;

converting the file: and executing file conversion operation according to the file data information and the analysis parameters to obtain a target file.

The invention also provides a computer readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the steps of the method suitable for file conversion of the credit-creation self-service terminal are realized.

The invention has the beneficial effects that:

1. the system for converting the files of the credit-creation self-service terminal can realize the automatic conversion of various original files of supporting text files, picture files, webpage files and PDF files, meet the complicated and changeable service requirements and improve the file conversion efficiency;

2. the method for converting the files of the credit-creation self-service terminal can realize flexible configuration according to actual requirements, support the conversion of a universal format and a customized format and improve the universality of file conversion;

3. the medium suitable for the file conversion of the credit-creation self-service terminal can realize cross-platform convenient deployment, is convenient to transplant in the technical scheme, and improves the reusability of file conversion.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.

Fig. 1 is a schematic diagram of a system for file conversion of a trusted self-service terminal according to embodiment 1 of the present invention;

fig. 2 is a schematic diagram of a file parsing module of a system suitable for file conversion of a trusted self-service terminal according to embodiment 1 of the present invention;

fig. 3 is a schematic diagram of a file conversion module of a system suitable for file conversion of a trusted self-service terminal according to embodiment 1 of the present invention;

fig. 4 is a flowchart of a method for file conversion of a trusted self-service terminal according to embodiment 2 of the present invention;

FIG. 5 is an exemplary diagram illustrating a file size conversion policy in two embodiments of the invention.

Detailed Description

The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

In the description of the present invention, unless explicitly specified or limited otherwise, it is to be noted that the "file acquisition module", "configuration management module", "parameter parsing module", "file conversion module", "original file", "first parameter", "second parameter", "parameter parsing operation", "parsing parameter", "file parsing operation", "file data information", "file conversion operation", "target file", "first type file", "second type file", "third type file", "fourth type file", "first data information", "second data information", "third data information", "fourth data information", "text file parsing unit", "picture file parsing unit", "web file parsing unit", "PDF file parsing unit", "text file parsing operation", and the like, "picture file parsing operation", "web file parsing operation", "portable file parsing operation", "text file conversion unit", "web file conversion unit", "picture file conversion unit", "PDF file conversion unit", "text file conversion operation", "web file conversion operation", "picture file conversion operation", "portable file conversion operation", "file size conversion policy", "file size conversion operation", "safe clipping value", "clipping threshold", "clipping region calculation operation", "clipping region coordinate", "file clipping operation", "clipping file", "picture scaling stretch ratio", "first skew distance", "first skew angle", "target coordinate calculation operation", "target coordinate", "clipping file attachment operation", "first text file conversion mode"), The terms "second text file conversion mode", "first text conversion mode", "second text conversion mode", "first web page file conversion mode", "second web page file conversion mode", "first web page conversion mode", "second web page conversion mode", "first PDF file conversion mode", "second PDF file conversion mode", "third PDF file conversion mode", "first PDF conversion mode", "second PDF conversion mode", "third PDF conversion mode", and the like should be understood in a broad sense. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.

Furthermore, the terms "first", "second", "third", "fourth" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first," "second," "third," or "fourth" may explicitly or implicitly include at least one of the feature.

Example 1

An embodiment of the present invention provides a system for file conversion in a trusted self-service terminal, please refer to fig. 1 to 3 and 5, including: the system comprises a file acquisition module, a configuration management module, a parameter analysis module, a file analysis module and a file conversion module;

a file acquisition module:

the file acquisition module is used for acquiring an original file and a first parameter;

specifically, a file acquisition module acquires an original file, namely a file needing conversion; acquiring parameter information corresponding to the original file;

for the sake of better clarity of explanation of the present invention, it is illustrated here that the original file is set as a text file, and the first parameter corresponding to the original file is to convert the text file into a file in a4 format; setting an original file as a picture file, wherein a first parameter corresponding to the original file is a file for converting the picture file into an A5 format; setting an original file as a webpage file, wherein a first parameter corresponding to the original file is a file for converting the text file into an A4 format; the original file is set to be a PDF file, and the first parameter corresponding to the original file is to convert the PDF file into a file of one third a4 size.

A configuration management module:

the configuration management module is used for acquiring configuration parameters and obtaining second parameters through the configuration parameters;

specifically, the configuration management module obtains a configuration parameter in a preset configuration file to obtain a second parameter;

in order to explain the present invention more clearly, the above examples are continued to illustrate, and information such as the paper size and the page margin of the a4 format and the a5 format is acquired, information such as the paper size and the page margin of one third a4 is acquired, and parameters such as the conversion mode of the corresponding file set in the configuration file are acquired.

A parameter analysis module:

the parameter analysis module is used for executing parameter analysis operation on the first parameter and the second parameter to obtain analysis parameters;

specifically, the parameter analysis module analyzes the first parameter and the second parameter, so as to obtain an analysis parameter;

in order to explain the present invention more clearly, the above example is continued to illustrate, and it is assumed that the user wants to convert a text file, but the user does not set the format of the converted target file, then the parameter parsing module may convert the text file into the default file format according to the default parameter information in the second parameter; assuming that the format of the first parameter input by the user has an error, inputting A4 paper as a4.5 paper, and then the parameter parsing module may correct the error to be A4 according to a default error handling rule in the second parameter; and then, assuming that the original file with conversion is a text file and the conversion mode in the second parameter is a second conversion mode, the parameter analysis module combines the format of the original file and the conversion mode in the second parameter to set the conversion mode of the text file as the second text conversion mode.

A file analysis module:

the file analysis module is used for executing file analysis operation on the original file to obtain file data information; the file analysis module comprises a text file analysis unit, a picture file analysis unit, a webpage file analysis unit and a PDF file analysis unit;

a text file analysis unit:

the text file analysis unit is used for executing text file analysis operation on the first type of file to obtain the first data information;

specifically, the text file analyzing unit acquires an original file, and when the original file is a first type of file, namely a text file, the text file analyzing unit analyzes the text file to obtain first data information, namely information such as the type, attribute and file content of the text file; when the original file is not the first type file, the text file parsing unit does not perform a text file parsing operation.

A picture file analysis unit:

the picture file analysis unit is used for executing picture file analysis operation on the second class of files to obtain the second data information;

specifically, the picture file analyzing unit acquires an original file, and when the original file is a second type of file, namely a picture file, the picture file analyzing unit analyzes the picture file to obtain second data information, namely information such as the type, attribute and file content of the picture file; when the original file is not the second type file, the picture file parsing unit does not perform the picture file parsing operation.

A webpage file analysis unit:

the webpage file analyzing unit is used for executing webpage file analyzing operation on the third type of files to obtain the third data information;

specifically, the web page file analyzing unit acquires an original file, and when the original file is a third-class file, namely a web page file, the picture file analyzing unit analyzes the web page file to obtain third data information, namely information such as the type, attribute and file content of the picture file; when the original file is not the third type file, the webpage file analyzing unit does not execute webpage file analyzing operation.

A PDF file analysis unit:

the PDF file analysis unit is used for executing portable file analysis operation on the fourth type of file to obtain the fourth data information;

specifically, the PDF file analyzing unit obtains an original file, and when the original file is a fourth type of file, that is, a PDF file, the PDF file analyzing unit analyzes the PDF file to obtain fourth data information, that is, information such as the type, attribute, and file content of the PDF file; when the original file is not the fourth type file, the PDF file parsing unit does not perform the portable file parsing operation.

The file conversion module:

the file conversion module is used for executing file conversion operation according to the file data information and the analysis parameters to obtain a target file; the file conversion module comprises a text file conversion unit, a webpage file conversion unit, an image file conversion unit and a PDF file conversion unit;

a text file conversion unit:

the text file conversion unit is used for executing text file conversion operation according to the first data information and the analysis parameter to obtain the target file;

specifically, the text file conversion unit obtains the parsing parameters, and obtains a value of a conversion mode in the parsing parameters:

when the value of the conversion mode is a first text conversion mode, the text file conversion unit calls the first text file conversion mode to execute text file conversion operation on the first data information to obtain a target file;

when the value of the conversion mode is a second text conversion mode, the text file conversion unit calls the second text file conversion mode to execute text file conversion operation on the first data information to obtain a target file;

to explain the present invention more clearly, it is exemplified here that, when the conversion schema is the first text conversion schema, the first data information is converted by the schema of text parsing and element processing, the first data information is converted into the target PDF file by QPrinter or QpdfWriter in QT; when the conversion mode is the second text conversion mode, the first data information is converted into the target PDF file by QWebEngine in QT.

A picture file conversion unit:

the picture file conversion unit is used for executing picture file conversion operation according to the second data information and the analysis parameter to obtain the target file;

specifically, the picture file conversion unit acquires the second data information and the analysis parameter, and executes picture file conversion operation on the third data information according to data in the analysis parameter to obtain a target file;

to explain the present invention more clearly, it is assumed that the third data information is converted into a PDF file by setting in the parsing parameters, and then the third data information is converted into an Image object by openCV or QT native method, and the Image object is converted into a target PDF file by QPrinter or QpdfWriter.

The webpage file conversion unit:

the webpage file conversion unit is used for executing webpage file conversion operation according to the third data information and the analysis parameter to obtain the target file;

specifically, the web file conversion unit obtains the analysis parameters, and obtains a value of a conversion mode in the analysis parameters:

when the conversion mode is the first webpage conversion mode, the webpage file conversion unit calls the first webpage file conversion mode to execute webpage file conversion operation on the third data information to obtain a target file;

when the conversion mode is the second webpage conversion mode, the webpage file conversion unit calls the second webpage file conversion mode to execute webpage file conversion operation on the third data information to obtain a target file;

to explain the present invention more clearly, it is exemplified herein that when the conversion mode is the first netpage file conversion mode, the second data information is converted into the target PDF file by QWebEngine in QT; and when the conversion mode is the second webpage file conversion mode, converting the second data information into a target PDF file through a wkhtmltopdf tool.

A PDF file conversion unit:

the PDF file conversion unit is used for executing portable file conversion operation according to the fourth data information and the analysis parameter to obtain the target file;

specifically, the PDF file conversion unit obtains the parsing parameters, and obtains a value of a conversion pattern in the parsing parameters:

when the conversion mode is the first PDF file conversion mode, the PDF file conversion unit calls the first PDF file conversion mode to execute portable file conversion operation on the fourth data information to obtain a target file;

when the conversion mode is a second PDF file conversion mode, the PDF file conversion unit calls the second PDF file conversion mode to execute portable file conversion operation on fourth data information to obtain a target file;

when the conversion mode is a third PDF file conversion mode, the PDF file conversion unit calls the third PDF file conversion mode to execute portable file conversion operation on fourth data information to obtain a target file;

when the PDF file conversion unit calls the first PDF file conversion mode to execute portable file conversion operation on the fourth data information and the PDF file conversion unit calls the second PDF file conversion mode to execute portable file conversion operation on the fourth data information, the PDF file conversion unit acquires the file size of a target file in the analysis parameters, compares the file size of the target file with the file size of an original file, and directly executes the portable file conversion operation if the two file sizes are the same; if the sizes of the two files are not equal, a file size conversion strategy is called to convert the file size firstly, namely a set safe cutting value is obtained, and a cutting threshold value is set according to the safe cutting value; calculating the coordinate of the cutting area according to the cutting threshold and the coordinate information of the original file; cutting the file converted from the original file according to the cutting area coordinates to obtain a cut file; then obtaining the size information of the target format file, the picture scaling and stretching ratio, and the first slope distance and the first offset angle of the cut file and the target format file, and calculating a target coordinate according to the data; adding the cut file to a target format file according to the target coordinate to obtain a target file;

to explain the present invention more clearly, it is exemplified herein that, when the conversion mode is the third PDF file conversion mode, the fourth data information is converted into the target PDF file by the MuPDF; when the conversion mode is a first PDF file conversion mode, namely a capture mode, converting fourth data information into an Image object through an ImageMagick picture-to-QT native method or openCV picture analysis, then calling a file size conversion strategy to cut and convert the Image object, and converting the cut Image object into a target PDF file through QPrinter or QpdfWriter; and when the conversion mode is the second PDF file conversion mode, converting the fourth data information into an Image object through a C + + class library Poppler, calling a file size conversion strategy to perform cutting conversion on the Image object, and converting the cut Image object into a target PDF file through QPrinter or QpdfWriter.

The file size conversion strategy is explained by way of example with reference to FIG. 5: in fig. 5, a is a clipping range, b is a skew distance, c is an offset angle, a safe clipping value is set to be a, that is, a critical safe area is reserved in fig. 5, and a clipping threshold value is set to be S according to the safe clipping value a, wherein S is greater than or equal to a; setting the coordinates of the original region as { (x1, y1), (x2, y2) }, the cropping range is { left, top, right, bottom }, then the coordinates of the cropping region can be obtained as { (x1+ left S%, y1+ top S%), (x2-right S%, y2-bottom S%) }, the coordinates of the new sheet are set as { (a1, b1), (a2, b2) }, the zoom ratio is set as Z, the skew distance is set as L, the offset angle is i, then the target coordinates can be calculated as { (a1+ L cos) (angle), (b1+ L sin), (angle), (a1+ L) + + (x 638%), (Z) + (2%) and (Z + x + -%) (2 +) (x — int). And attaching the clipping file to the target format file through the target coordinate to obtain a target file.

It should be noted that the above examples in each module or each unit are only for clearly explaining the implementation process of the present invention, and therefore the protection scope of the present invention is not limited by the above examples.

Example 2

The embodiment of the present invention further provides a method for file conversion suitable for a trusted self-service terminal, please refer to fig. 4 and 5, including the following steps:

s100, acquiring a file:

acquiring an original file, namely a file needing to be converted; acquiring parameter information corresponding to the original file;

for the sake of better clarity of explanation of the present invention, it is illustrated here that the original file is set as a text file, and the first parameter corresponding to the original file is to convert the text file into a file in a4 format; setting an original file as a picture file, wherein a first parameter corresponding to the original file is a file for converting the picture file into an A5 format; setting an original file as a webpage file, wherein a first parameter corresponding to the original file is a file for converting the text file into an A4 format; the original file is set to be a PDF file, and the first parameter corresponding to the original file is to convert the PDF file into a file of one third a4 size.

Acquiring configuration parameters in a preset configuration file to obtain second parameters;

in order to explain the present invention more clearly, the above examples are continued to illustrate, and information such as the paper size and the page margin of the a4 format and the a5 format is acquired, information such as the paper size and the page margin of one third a4 is acquired, and parameters such as the conversion mode of the corresponding file set in the configuration file are acquired.

S200, configuring parameters:

analyzing the first parameter and the second parameter to obtain an analysis parameter;

in order to explain the present invention more clearly, the above example is continued to illustrate, and it is assumed that the user wants to convert a text file, but the format of the converted target file is not set by the user, then the text file can be converted into the default file format according to the default parameter information in the second parameter; assuming that the format of the first parameter input by the user has an error, inputting A4 paper as a4.5 paper, and correcting the error to be A4 according to the default error processing rule in the second parameter; and then, assuming that the original file with conversion is a text file and the conversion mode in the second parameter is a second conversion mode, setting the conversion mode of the text file as the second text conversion mode by combining the original file format and the conversion mode in the second parameter.

S300, file analysis:

acquiring the file type of an original file, and executing corresponding file analysis operation according to the file type:

if the file type is a first type file, namely a text file, analyzing the text file to obtain first data information, namely information such as the type, the attribute, the file content and the like of the text file;

if the file type is a second type file, namely a picture file, analyzing the picture file to obtain second data information, namely information such as the type, the attribute, the file content and the like of the picture file;

if the file type is a third type of file, namely a webpage file, analyzing the webpage file to obtain third data information, namely information such as the type, the attribute, the file content and the like of the picture file;

if the file type is a fourth type file, namely a PDF file, the PDF file is analyzed to obtain fourth data information, namely information such as the type, attribute, file content and the like of the PDF file.

S400, converting the file:

and executing corresponding file conversion operation according to the file types:

if the file type is a first type file, namely a text file, acquiring analysis parameters to obtain a value of a conversion mode in the analysis parameters:

if the value of the conversion mode is the first text conversion mode, calling the first text file conversion mode to execute text file conversion operation on the first data information to obtain a target file;

if the value of the conversion mode is the second text conversion mode, calling the second text file conversion mode to execute text file conversion operation on the first data information to obtain a target file;

to explain the present invention more clearly, it is exemplified here that, when the conversion schema is the first text conversion schema, the first data information is converted by the schema of text parsing and element processing, the first data information is converted into the target PDF file by QPrinter or QpdfWriter in QT; when the conversion mode is the second text conversion mode, the first data information is converted into the target PDF file by QWebEngine in QT.

If the file type is a second type file, namely a picture file, second data information and analysis parameters are obtained, and picture file conversion operation is performed on third data information according to data in the analysis parameters to obtain a target file;

to explain the present invention more clearly, it is assumed that the third data information is converted into a PDF file by setting in the parsing parameters, and then the third data information is converted into an Image object by openCV or QT native method, and the Image object is converted into a target PDF file by QPrinter or QpdfWriter.

If the file type is a third type of file, namely a webpage file, acquiring analysis parameters to obtain a value of a conversion mode in the analysis parameters:

if the conversion mode is the first webpage conversion mode, calling the first webpage file conversion mode to execute webpage file conversion operation on the third data information to obtain a target file;

if the conversion mode is the second webpage conversion mode, calling the second webpage file conversion mode to execute webpage file conversion operation on the third data information to obtain a target file;

to explain the present invention more clearly, it is exemplified herein that when the conversion mode is the first netpage file conversion mode, the second data information is converted into the target PDF file by QWebEngine in QT; and when the conversion mode is the second webpage file conversion mode, converting the second data information into a target PDF file through a wkhtmltopdf tool.

If the file type is a fourth type file, namely a PDF file, acquiring analysis parameters to obtain a value of a conversion mode in the analysis parameters:

if the conversion mode is the first PDF file conversion mode, calling the first PDF file conversion mode to execute portable file conversion operation on the fourth data information to obtain a target file;

if the conversion mode is the second PDF file conversion mode, calling the second PDF file conversion mode to execute portable file conversion operation on the fourth data information to obtain a target file;

if the conversion mode is the third PDF file conversion mode, calling the third PDF file conversion mode to execute portable file conversion operation on the fourth data information to obtain a target file;

when the first PDF file conversion mode is called to execute portable file conversion operation on the fourth data information and the second PDF file conversion mode is called to execute portable file conversion operation on the fourth data information, the file size of a target file in the analysis parameters is obtained, the file size of the target file is compared with the file size of an original file, and if the two file sizes are the same, the portable file conversion operation is directly executed; if the sizes of the two files are not equal, a file size conversion strategy is called to convert the file size firstly, namely a set safe cutting value is obtained, and a cutting threshold value is set according to the safe cutting value; calculating the coordinate of the cutting area according to the cutting threshold and the coordinate information of the original file; cutting the file converted from the original file according to the cutting area coordinates to obtain a cut file; then obtaining the size information of the target format file, the picture scaling and stretching ratio, and the first slope distance and the first offset angle of the cut file and the target format file, and calculating a target coordinate according to the data; adding the cut file to a target format file according to the target coordinate to obtain a target file;

to explain the present invention more clearly, it is exemplified herein that, when the conversion mode is the third PDF file conversion mode, the fourth data information is converted into the target PDF file by the MuPDF; when the conversion mode is a first PDF file conversion mode, namely a capture mode, converting fourth data information into an Image object through an ImageMagick picture-to-QT native method or openCV picture analysis, then calling a file size conversion strategy to cut and convert the Image object, and converting the cut Image object into a target PDF file through QPrinter or QpdfWriter; and when the conversion mode is the second PDF file conversion mode, converting the fourth data information into an Image object through a C + + class library Poppler, calling a file size conversion strategy to perform cutting conversion on the Image object, and converting the cut Image object into a target PDF file through QPrinter or QpdfWriter.

The file size conversion strategy is explained by way of example with reference to FIG. 5: in fig. 5, a is a clipping range, b is a skew distance, c is an offset angle, a safe clipping value is set to be a, that is, a critical safe area is reserved in fig. 5, and a clipping threshold value is set to be S according to the safe clipping value a, wherein S is greater than or equal to a; setting the coordinates of the original region as { (x1, y1), (x2, y2) }, the cropping range is { left, top, right, bottom }, then the coordinates of the cropping region can be obtained as { (x1+ left S%, y1+ top S%), (x2-right S%, y2-bottom S%) }, the coordinates of the new sheet are set as { (a1, b1), (a2, b2) }, the zoom ratio is set as Z, the skew distance is set as L, the offset angle is i, then the target coordinates can be calculated as { (a1+ L cos) (angle), (b1+ L sin), (angle), (a1+ L) + + (x 638%), (Z) + (2%) and (Z + x + -%) (2 +) (x — int). And attaching the clipping file to the target format file through the target coordinate to obtain a target file.

It should be noted that, the above-mentioned steps are only used for clearly explaining the implementation process of the present invention, and therefore, the protection scope of the present invention is not limited by the above-mentioned examples.

Example 3

This embodiment 3 has a computer-readable storage medium for storing computer software instructions for implementing the method for file conversion suitable for the trusted self-service terminal described in embodiment 2 above, and the storage medium contains a program configured for the method for file conversion suitable for the trusted self-service terminal; specifically, the executable program may be embedded in the system for file conversion applicable to the credit creation self-service terminal described in embodiment 1, so that the system for file conversion applicable to the credit creation self-service terminal may implement the method for file conversion applicable to the credit creation self-service terminal described in embodiment 2 by executing the embedded executable program.

The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.

It will be understood by those skilled in the art that all or part of the steps of implementing the above embodiments may be implemented by hardware, and a program that can be implemented by the hardware and can be instructed by the program to be executed by the relevant hardware may be stored in a computer readable storage medium, where the storage medium may be a read-only memory, a magnetic or optical disk, and the like.

The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:文件处理方法、装置及电子设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!