CN-122021595-A - Identification card generation method and device, computer equipment and storage medium
Abstract
The invention relates to an identification card generation method, an identification card generation device, computer equipment and a storage medium. The method comprises the steps of obtaining an original identity recognition card template according to an identity recognition card generation command, obtaining the original identity recognition card template, wherein the original identity recognition card template comprises dynamic elements, style rules and typesetting rules, the style rules comprise positions of the dynamic elements and sizes of the dynamic elements, the typesetting rules comprise typesetting modes of the identity recognition cards on pages, obtaining multiple pieces of original data from a database according to the dynamic elements, each piece of original data comprises multiple structured fields, each structured field corresponds to one dynamic element, filling the structured fields into the dynamic elements according to the positions of the dynamic elements and the sizes of the dynamic elements to generate a single recognition card, typesetting the multiple single recognition cards on the pages according to the typesetting rules to obtain the whole page of recognition cards, and outputting an identity recognition card printing file according to the whole page of recognition cards. The invention can improve the generation efficiency of the identification card.
Inventors
- Yang Huankun
- LI TENG
- LIN ZHENGJIE
- HUANG WU
- YANG TING
Assignees
- 深圳市海云天科技股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260123
Claims (10)
- 1. A method of generating an identification card, the method comprising: According to an identification card generation command, an original identification card template is obtained, wherein the original identification card template comprises dynamic elements, style rules and typesetting rules, the style rules comprise positions of the dynamic elements and sizes of the dynamic elements, and the typesetting rules comprise typesetting modes of the identification card on a page; acquiring a plurality of pieces of original data from a database according to the dynamic elements, wherein each piece of original data comprises a plurality of structured fields, and each structured field corresponds to one dynamic element; Filling the structured field into the dynamic element according to the position of the dynamic element and the size of the dynamic element to generate a monomer identification card; Typesetting a plurality of single identification cards on a page according to the typesetting rule to obtain a whole page of identification cards; and outputting the identification card print file according to the whole page of identification cards.
- 2. The method of claim 1, wherein the obtaining, from the database, a plurality of pieces of raw data according to the dynamic elements, each piece of raw data including a plurality of structured fields, each structured field corresponding to one dynamic element, comprises: if the dynamic element includes dynamic logic, then: According to the dynamic logic, a logic field is newly added in the original data, and the logic field is subjected to data filling, so that the logic field corresponds to the dynamic logic; wherein the dynamic logic is a physical place number.
- 3. The method of claim 1, wherein the obtaining, from the database, a plurality of pieces of raw data according to the dynamic elements, each piece of raw data including a plurality of structured fields, each structured field corresponding to one dynamic element, comprises: If the dynamic element includes a first number, a second number and a numbering rule, then: Adding a logic field in the original data according to the first number and the numbering rule, and filling the logic field with data according to the second number to enable the logic field to correspond to the second number; wherein the first number is a continuous number and the second number is a physical location number.
- 4. The method according to claim 1, wherein typesetting the plurality of individual identification cards on the page according to the typesetting rule to obtain a whole page of identification cards comprises: obtaining the number of the monomer identification cards contained on each page; paging all the monomer identification cards to obtain a paging result; and typesetting the monomer identification cards on each page according to the paging result.
- 5. The method of claim 1, wherein outputting the identification card print file based on the full page identification card comprises: Rendering the whole page of identification cards to obtain a rendering file; and after the rendering file is encoded, the identification card printing file is obtained.
- 6. The method of claim 5, wherein rendering the entire page of tiles to obtain a rendered file comprises: loading the whole page identification plate, and generating an HTML document according to the size and the printing resolution of the target printed matter; Configuring a rendering size and a pixel density according to the target print size and the printing resolution; And analyzing the HTML document, and rendering according to the rendering size and the pixel density to obtain the rendering file.
- 7. The method of claim 6, wherein the obtaining the identification card print file after encoding the rendering file comprises: coding the rendering file according to the output mode, and taking the coded file as the identification card printing file; Wherein the output modes include a high resolution mode and a low resolution mode.
- 8. An identification card generating device, the device comprising: The template acquisition unit is used for acquiring an original identity recognition card template according to an identity recognition card generation command, wherein the original identity recognition card template comprises dynamic elements, style rules and typesetting rules, the style rules comprise positions of the dynamic elements and sizes of the dynamic elements, and the typesetting rules comprise typesetting modes of the identity recognition cards on a page; The data acquisition unit is used for acquiring a plurality of pieces of original data from the database according to the dynamic elements, wherein each piece of original data comprises a plurality of structured fields, and each structured field corresponds to one dynamic element; The generation unit is used for filling the structured field into the dynamic element according to the position of the dynamic element and the size of the dynamic element to generate a monomer identification board; The typesetting unit is used for typesetting a plurality of single identification cards on a page according to the typesetting rule so as to obtain a whole page of identification cards; and the output unit is used for outputting the identification card print file according to the whole page of identification cards.
- 9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 7 when executing the computer program.
- 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of any of claims 1 to 7.
Description
Identification card generation method and device, computer equipment and storage medium Technical Field The present invention relates to the field of data processing, and in particular, to a method and apparatus for generating an identification card, a computer device, and a storage medium. Background Identification cards are key materials for identifying personnel information, and particularly identification cards bound with seats, such as examination seat stickers are important items. In the prior art, the identification cards rely on office software such as Word, excel and the like to manually typeset, so that the efficiency is low, mistakes are easy to occur, and the requirements of large-scale or frequent information change are difficult to deal with. Disclosure of Invention In order to solve the technical problems or at least partially solve the technical problems, the invention provides an identification card generation method, an identification card generation device, computer equipment and a storage medium. In a first aspect, the present invention provides a method for generating an identification card, the method comprising: According to an identification card generation command, an original identification card template is obtained, wherein the original identification card template comprises dynamic elements, style rules and typesetting rules, the style rules comprise positions of the dynamic elements and sizes of the dynamic elements, and the typesetting rules comprise typesetting modes of the identification card on a page; acquiring a plurality of pieces of original data from a database according to the dynamic elements, wherein each piece of original data comprises a plurality of structured fields, and each structured field corresponds to one dynamic element; Filling the structured field into the dynamic element according to the position of the dynamic element and the size of the dynamic element to generate a monomer identification card; Typesetting a plurality of single identification cards on a page according to the typesetting rule to obtain a whole page of identification cards; and outputting the identification card print file according to the whole page of identification cards. Optionally, the obtaining a plurality of pieces of original data from a database according to the dynamic element, where each piece of original data includes a plurality of structured fields, each structured field corresponds to one dynamic element, and includes: if the dynamic element includes dynamic logic, then: According to the dynamic logic, a logic field is newly added in the original data, and the logic field is subjected to data filling, so that the logic field corresponds to the dynamic logic; wherein the dynamic logic is a physical place number. Optionally, the obtaining a plurality of pieces of original data from a database according to the dynamic element, where each piece of original data includes a plurality of structured fields, each structured field corresponds to one dynamic element, and includes: If the dynamic element includes a first number, a second number and a numbering rule, then: Adding a logic field in the original data according to the first number and the numbering rule, and filling the logic field with data according to the second number to enable the logic field to correspond to the second number; wherein the first number is a continuous number and the second number is a physical location number. Optionally, according to the typesetting rule, typesetting the plurality of monomer identification cards on the page to obtain a whole page identification card, including: obtaining the number of the monomer identification cards contained on each page; paging all the monomer identification cards to obtain a paging result; and typesetting the monomer identification cards on each page according to the paging result. Optionally, the step of outputting the identification card print file according to the whole page identification card includes: Rendering the whole page of identification cards to obtain a rendering file; and after the rendering file is encoded, the identification card printing file is obtained. Optionally, the rendering the whole page of identification cards to obtain a rendering file includes: loading the whole page identification plate, and generating an HTML document according to the size and the printing resolution of the target printed matter; Configuring a rendering size and a pixel density according to the target print size and the printing resolution; And analyzing the HTML document, and rendering according to the rendering size and the pixel density to obtain the rendering file. Optionally, after the rendering file is encoded, the identification card print file is obtained, including: coding the rendering file according to the output mode, and taking the coded file as the identification card printing file; Wherein the output modes include a high resolution mode and a low res